toast 中的信息怎么分两行显示(android toast 边框开发),急!!!!

Android开发中提示框Toast、AlertDialog的使用
先了解一下AlertDialog.Builder创建对话框的几个常用方法:
setTitle() :设置标题
setIcon() :设置图标
setMessage():设置提示内容
setView() : 设置自定义视图
setItems() :设置对话框要显示的一个list
setMultiChoiceItems() :设置对话框显示的复选框
setNeutralButton() :普通按钮
setPositiveButton() :添加"Yes"按钮
setNegativeButton() :添加"No"按钮
create() : 创建对话框
show() :显示对话框
下面以一个例子简单演示一下其应用,先看一下效果图:
Toast的使用效果:
AlertDialog的简单使用:
类似于ListView的效果:
类似于RadioButton的效果:
多选的效果:
自定义视图:
代码示例如下:
一个主activity,两个布局文件;
ReviewCriteria.
package com.test.&
import android.app.A&
import android.app.AlertD&
import android.content.DialogI&
import android.os.B&
import android.util.L&
import android.view.G&
import android.view.LayoutI&
import android.view.M&
import android.view.V&
import android.view.View.OnClickL&
import android.widget.B&
import android.widget.T&
public class ReviewCriteria extends Activity {&
&&& private static final String tag = "reviewCriteria";&
&&& private final String arrayFruit[] = new String[]{"apple","banana","pear"};&
&&& private Button tishiButton =&&&&& //提示Toast的按钮&&
&&& private Button tishiAlert =&&&&&& //普通AlertDialog&&
&&& private Button tishiAlertItem =&& //类似ListItem&&
&&& private Button AlertRadio =&&&&&& //类似RadioButton&&
&&& private int selectedFruitIndex = 0;&&&&&&
&&& private Button CheckButton =&&&&& //类似CheckBox&&
&&& final boolean[] arrayFruitSelected = new boolean[] {false, true, false}; //默认选中&&
&&& private Button myCustomButton =&&&&&& //自定义视图&&
&&& private View myCustomView =&
&&& @Override&
&&& protected void onCreate(Bundle savedInstanceState) {&
&&&&&&& super.onCreate(savedInstanceState);&
&&&&&&& setContentView(R.layout.activity_review_criteria);&
&&&&&&& this.tishiButton = (Button)findViewById(R.id.tishiButton);&
&&&&&&& this.tishiAlert = (Button)findViewById(R.id.tishiAlart);&
&&&&&&& this.tishiAlertItem = (Button)findViewById(R.id.AlertItem);&
&&&&&&& this.AlertRadio = (Button)findViewById(R.id.AlertSingleChoice);&
&&&&&&& this.CheckButton = (Button)findViewById(R.id.AlertCheckBox);&
&&&&&&& this.myCustomButton = (Button)findViewById(R.id.customView);&
&&&&&&& //Toast&&
&&&&&&& this.tishiButton.setOnClickListener(&
&&&&&&&&&&&&&&& new OnClickListener(){&
&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&& public void onClick(View v){&
&&&&&&&&&&&&&&&&&&&&&&& Log.i(tag, "in onClick1");&
&&&&&&&&&&&&&&&&&&&&&&& /*注:在内嵌函数中使用时context 一定要对,不能只是this,而应该是Class.this或者getApplicationContext()*/&
&&&&&&&&&&&&&&&&&&&&&&& //Toast.makeText(ReviewCriteria.this, "this is a toast", Toast.LENGTH_LONG).show();&&
&&&&&&&&&&&&&&&&&&&&&&& Toast toast = Toast.makeText(ReviewCriteria.this, "this is a toast", Toast.LENGTH_SHORT);&
&&&&&&&&&&&&&&&&&&&&&&& toast.setGravity(Gravity.CENTER, 0, 0);&
&&&&&&&&&&&&&&&&&&&&&&& toast.show();&
&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&& });&
&&&&&&& //AlertDialog&&
&&&&&&& this.tishiAlert.setOnClickListener(&
&&&&&&&&&&&&&&& new OnClickListener(){&
&&&&&&&&&&&&&&&&&&& public void onClick(View v){&
&&&&&&&&&&&&&&&&&&&&&&& new AlertDialog.Builder(ReviewCriteria.this).&
&&&&&&&&&&&&&&&&&&&&&&& setIcon(R.drawable.ic_launcher).//图标&&
&&&&&&&&&&&&&&&&&&&&&&& setTitle("Delete?").//标题&&
&&&&&&&&&&&&&&&&&&&&&&& setMessage("this is a AlertDialog!").//提示内容&&
&&&&&&&&&&&&&&&&&&&&&&& setPositiveButton("Yes", new DialogInterface.OnClickListener() {//确定&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface arg0, int arg1) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //yes to do&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).setNegativeButton("No", new DialogInterface.OnClickListener(){//取消&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface arg1,int witch){&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //no to do&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& setNeutralButton("More", new DialogInterface.OnClickListener() {//普通确定按钮&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //查看更多&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& show();&
&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&& });&
&&&&&&& //类似ListItem&&
&&&&&&& this.tishiAlertItem.setOnClickListener(&
&&&&&&&&&&&&&&& new OnClickListener(){&
&&&&&&&&&&&&&&&&&&& public void onClick(View v){&
&&&&&&&&&&&&&&&&&&&&&&& new AlertDialog.Builder(ReviewCriteria.this).&
&&&&&&&&&&&&&&&&&&&&&&& setTitle("witch do you like?").&
&&&&&&&&&&&&&&&&&&&&&&& setItems(arrayFruit,new DialogInterface.OnClickListener() {//Items to choose&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Toast.makeText(ReviewCriteria.this, arrayFruit[which], Toast.LENGTH_LONG).show();&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& setNegativeButton("cancel", new DialogInterface.OnClickListener() {//cancel&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //cancel to do&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& show();&
&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&& });&
&&&&&&& //类似RadioButton&&
&&&&&&& this.AlertRadio.setOnClickListener(&
&&&&&&&&&&&&&&& new OnClickListener(){&
&&&&&&&&&&&&&&&&&&& public void onClick(View v){&
&&&&&&&&&&&&&&&&&&&&&&& new AlertDialog.Builder(ReviewCriteria.this).&
&&&&&&&&&&&&&&&&&&&&&&& setTitle("witch do you like?").&
&&&&&&&&&&&&&&&&&&&&&&& setSingleChoiceItems(arrayFruit, 0, new DialogInterface.OnClickListener() {&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& selectedFruitIndex =&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& setPositiveButton("OK",new DialogInterface.OnClickListener() {&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Toast.makeText(ReviewCriteria.this, arrayFruit[selectedFruitIndex], Toast.LENGTH_LONG).show();&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& setNegativeButton("Cancel", new DialogInterface.OnClickListener() {//cancel&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //cancel to do&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& show();&
&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&& });&
&&&&&&& //类似CheckBox&&
&&&&&&& this.CheckButton.setOnClickListener(&
&&&&&&&&&&&&&&& new OnClickListener(){&
&&&&&&&&&&&&&&&&&&& public void onClick(View v){&
&&&&&&&&&&&&&&&&&&&&&&& new AlertDialog.Builder(ReviewCriteria.this).&
&&&&&&&&&&&&&&&&&&&&&&& setTitle("which do you like?").&
&&&&&&&&&&&&&&&&&&&&&&& setMultiChoiceItems(arrayFruit, arrayFruitSelected, new DialogInterface.OnMultiChoiceClickListener() {&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface arg0, int which, boolean isChecked) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& arrayFruitSelected[which] = isC&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& setPositiveButton("OK",new DialogInterface.OnClickListener() {&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& String toastString = "你选中了:";&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& for(int i = 0;i & arrayFruit. i++){&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if(arrayFruitSelected[i]){&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& toastString += arrayFruit[i]+"、";&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Toast.makeText(ReviewCriteria.this, toastString, Toast.LENGTH_LONG).show();&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& setNegativeButton("Cancel", new DialogInterface.OnClickListener() {&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& show();&
&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&& });&
&&&&&&& //自定义视图&&
&&&&&&& LayoutInflater layoutInflater = LayoutInflater.from(this);&
&&&&&&& myCustomView = layoutInflater.inflate(R.layout.customview, null);&
&&&&&&& this.myCustomButton.setOnClickListener(&
&&&&&&&&&&&&&&& new OnClickListener(){&
&&&&&&&&&&&&&&&&&&& public void onClick(View v){&
&&&&&&&&&&&&&&&&&&&&&&& new AlertDialog.Builder(ReviewCriteria.this).&
&&&&&&&&&&&&&&&&&&&&&&& setTitle("login").&
&&&&&&&&&&&&&&&&&&&&&&& setView(myCustomView).&
&&&&&&&&&&&&&&&&&&&&&&& setPositiveButton("Login", new DialogInterface.OnClickListener() {&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& setNegativeButton("Cancel", new DialogInterface.OnClickListener() {&
&&&&&&&&&&&&&&&&&&&&&&&&&&& @Override&
&&&&&&&&&&&&&&&&&&&&&&&&&&& public void onClick(DialogInterface dialog, int which) {&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&&&&&&&&&& }).&
&&&&&&&&&&&&&&&&&&&&&&& show();&
&&&&&&&&&&&&&&&&&&& }&
&&&&&&&&&&&&&&& });&
&&& @Override&
&&& public boolean onCreateOptionsMenu(Menu menu) {&
&&&&&&& // I this adds items to the action bar if it is present.&&
&&&&&&& getMenuInflater().inflate(R.menu.review_criteria, menu);&
package com.test.
import android.app.A
import android.app.AlertD
import android.content.DialogI
import android.os.B
import android.util.L
import android.view.G
import android.view.LayoutI
import android.view.M
import android.view.V
import android.view.View.OnClickL
import android.widget.B
import android.widget.T
public class ReviewCriteria extends Activity {
&private static final String tag = "reviewCriteria";
&private final String arrayFruit[] = new String[]{"apple","banana","pear"};
&private Button tishiButton =&&//提示Toast的按钮
&private Button tishiAlert =&&//普通AlertDialog
&private Button tishiAlertItem =&//类似ListItem
&private Button AlertRadio =&&//类似RadioButton
&private int selectedFruitIndex = 0; &
&private Button CheckButton =&&//类似CheckBox
&final boolean[] arrayFruitSelected = new boolean[] {false, true, false}; //默认选中
&private Button myCustomButton =&&//自定义视图
&private View myCustomView =
&@Override
&protected void onCreate(Bundle savedInstanceState) {
&&super.onCreate(savedInstanceState);
&&setContentView(R.layout.activity_review_criteria);
&&this.tishiButton = (Button)findViewById(R.id.tishiButton);
&&this.tishiAlert = (Button)findViewById(R.id.tishiAlart);
&&this.tishiAlertItem = (Button)findViewById(R.id.AlertItem);
&&this.AlertRadio = (Button)findViewById(R.id.AlertSingleChoice);
&&this.CheckButton = (Button)findViewById(R.id.AlertCheckBox);
&&this.myCustomButton = (Button)findViewById(R.id.customView);
&&this.tishiButton.setOnClickListener(
&&&&new OnClickListener(){
&&&&&@Override
&&&&&public void onClick(View v){
&&&&&&Log.i(tag, "in onClick1");
&&&&&&/*注:在内嵌函数中使用时context 一定要对,不能只是this,而应该是Class.this或者getApplicationContext()*/
&&&&&&//Toast.makeText(ReviewCriteria.this, "this is a toast", Toast.LENGTH_LONG).show();
&&&&&&Toast toast = Toast.makeText(ReviewCriteria.this, "this is a toast", Toast.LENGTH_SHORT);
&&&&&&&& &&&toast.setGravity(Gravity.CENTER, 0, 0);
&&&&&&&& &&&toast.show();
&&//AlertDialog
&&this.tishiAlert.setOnClickListener(
&&&&new OnClickListener(){
&&&&&public void onClick(View v){
&&&&&&new AlertDialog.Builder(ReviewCriteria.this).
&&&&&&setIcon(R.drawable.ic_launcher).//图标
&&&&&&setTitle("Delete?").//标题
&&&&&&setMessage("this is a AlertDialog!").//提示内容
&&&&&&setPositiveButton("Yes", new DialogInterface.OnClickListener() {//确定
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface arg0, int arg1) {
&&&&&&&&//yes to do
&&&&&&}).setNegativeButton("No", new DialogInterface.OnClickListener(){//取消
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface arg1,int witch){
&&&&&&&&//no to do
&&&&&&setNeutralButton("More", new DialogInterface.OnClickListener() {//普通确定按钮
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&&&//查看更多
&&&&&&show();
&&//类似ListItem
&&this.tishiAlertItem.setOnClickListener(
&&&&new OnClickListener(){
&&&&&public void onClick(View v){
&&&&&&new AlertDialog.Builder(ReviewCriteria.this).
&&&&&&setTitle("witch do you like?").
&&&&&&setItems(arrayFruit,new DialogInterface.OnClickListener() {//Items to choose
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&&&Toast.makeText(ReviewCriteria.this, arrayFruit[which], Toast.LENGTH_LONG).show();
&&&&&&setNegativeButton("cancel", new DialogInterface.OnClickListener() {//cancel
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&&&//cancel to do
&&&&&&show();
&&//类似RadioButton
&&this.AlertRadio.setOnClickListener(
&&&&new OnClickListener(){
&&&&&public void onClick(View v){
&&&&&&new AlertDialog.Builder(ReviewCriteria.this).
&&&&&&setTitle("witch do you like?").
&&&&&&setSingleChoiceItems(arrayFruit, 0, new DialogInterface.OnClickListener() {
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&&&selectedFruitIndex =
&&&&&&setPositiveButton("OK",new DialogInterface.OnClickListener() {
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&&&Toast.makeText(ReviewCriteria.this, arrayFruit[selectedFruitIndex], Toast.LENGTH_LONG).show();
&&&&&&setNegativeButton("Cancel", new DialogInterface.OnClickListener() {//cancel
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&&&//cancel to do
&&&&&&show();
&&//类似CheckBox
&&this.CheckButton.setOnClickListener(
&&&&new OnClickListener(){
&&&&&public void onClick(View v){
&&&&&&new AlertDialog.Builder(ReviewCriteria.this).
&&&&&&setTitle("which do you like?").
&&&&&&setMultiChoiceItems(arrayFruit, arrayFruitSelected, new DialogInterface.OnMultiChoiceClickListener() {
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface arg0, int which, boolean isChecked) {
&&&&&&&&arrayFruitSelected[which] = isC
&&&&&&setPositiveButton("OK",new DialogInterface.OnClickListener() {
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&&&String toastString = "你选中了:";
&&&&&&&&for(int i = 0;i & arrayFruit. i++){
&&&&&&&&&if(arrayFruitSelected[i]){
&&&&&&&&&&toastString += arrayFruit[i]+"、";
&&&&&&&&&}
&&&&&&&&Toast.makeText(ReviewCriteria.this, toastString, Toast.LENGTH_LONG).show();
&&&&&&setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&show();
&&//自定义视图
&&LayoutInflater layoutInflater = LayoutInflater.from(this);
&&myCustomView = layoutInflater.inflate(R.layout.customview, null);
&&this.myCustomButton.setOnClickListener(
&&&&new OnClickListener(){
&&&&&public void onClick(View v){
&&&&&&new AlertDialog.Builder(ReviewCriteria.this).
&&&&&&setTitle("login").
&&&&&&setView(myCustomView).
&&&&&&setPositiveButton("Login", new DialogInterface.OnClickListener() {
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
&&&&&&&@Override
&&&&&&&public void onClick(DialogInterface dialog, int which) {
&&&&&&show();
&@Override
&public boolean onCreateOptionsMenu(Menu menu) {
&&// I this adds items to the action bar if it is present.
&&getMenuInflater().inflate(R.menu.review_criteria, menu);
activity_review_criteria.xml[html] view plaincopyprint?
&RelativeLayout xmlns:android="/apk/res/android"&
&&& xmlns:tools="/tools"&
&&& android:layout_width="match_parent"&
&&& android:layout_height="match_parent"&
&&& android:paddingBottom="@dimen/activity_vertical_margin"&
&&& android:paddingLeft="@dimen/activity_horizontal_margin"&
&&& android:paddingRight="@dimen/activity_horizontal_margin"&
&&& android:paddingTop="@dimen/activity_vertical_margin"&
&&& tools:context=".ReviewCriteria" &&
&&& &TextView&
&&&&&&& android:id="@+id/title"&
&&&&&&& android:layout_width="wrap_content"&
&&&&&&& android:layout_height="wrap_content"&
&&&&&&& android:text="@string/hello_world" /&&
&&& &!--show tips by Toast& --&&
&&& &Button&
&&&&&&& android:id="@+id/tishiButton"&
&&&&&&& android:layout_below="@id/title"&
&&&&&&& android:layout_width="fill_parent"&
&&&&&&& android:layout_height="wrap_content"&
&&&&&&& android:text="show tips by Toast"/&&
&&& &!--show tips by AlertDialog& --&&
&&& &Button&&
&&&&&&& android:id="@+id/tishiAlart"&
&&&&&&& android:layout_below="@id/tishiButton"&
&&&&&&& android:layout_width="fill_parent"&
&&&&&&& android:layout_height="wrap_content"&
&&&&&&& android:text="show tips by AlertDialog"/&&
&&& &!--AlertDialog : Item选择,类似ListView --&&
&&& &Button&&
&&&&&&& android:id="@+id/AlertItem"&
&&&&&&& android:layout_below="@id/tishiAlart"&
&&&&&&& android:layout_width="fill_parent"&
&&&&&&& android:layout_height="wrap_content"&
&&&&&&& android:text="like ListView"/&&
&&& &!--AlertDialog : Item选择,类似RadioButton& --&&
&&& &Button&&
&&&&&&& android:id="@+id/AlertSingleChoice"&
&&&&&&& android:layout_below="@id/AlertItem"&
&&&&&&& android:layout_width="fill_parent"&
&&&&&&& android:layout_height="wrap_content"&
&&&&&&& android:text="Like RadioButton"/&&
&&& &!--AlertDialog : Item选择,类似CheckBox& --&&
&&& &Button&&
&&&&&&& :id="@+id/AlertCheckBox"&
&&&&&&& android:layout_below="@id/AlertSingleChoice"&
&&&&&&& android:layout_width="fill_parent"&
&&&&&&& android:layout_height="wrap_content"&
&&&&&&& android:text="Like CheckBox"/&&
&&& &!--AlertDialog : 自定义视图& --&&
&&& &Button&&
&&&&&&& android:id="@+id/customView"&
&&&&&&& android:layout_below="@id/AlertCheckBox"&
&&&&&&& android:layout_width="fill_parent"&
&&&&&&& android:layout_height="wrap_content"&
&&&&&&& android:text="CustomView"/&&
&/RelativeLayout&&
&RelativeLayout xmlns:android="/apk/res/android"
&&& xmlns:tools="/tools"
&&& android:layout_width="match_parent"
&&& android:layout_height="match_parent"
&&& android:paddingBottom="@dimen/activity_vertical_margin"
&&& android:paddingLeft="@dimen/activity_horizontal_margin"
&&& android:paddingRight="@dimen/activity_horizontal_margin"
&&& android:paddingTop="@dimen/activity_vertical_margin"
&&& tools:context=".ReviewCriteria" &
&&& &TextView
&&&&&&& android:id="@+id/title"
&&&&&&& android:layout_width="wrap_content"
&&&&&&& android:layout_height="wrap_content"
&&&&&&& android:text="@string/hello_world" /&
&&& &!--show tips by Toast& --&
&&& &Button
&&&&&&& android:id="@+id/tishiButton"
&&&&&&& android:layout_below="@id/title"
&&&&&&& android:layout_width="fill_parent"
&&&&&&& android:layout_height="wrap_content"
&&&&&&& android:text="show tips by Toast"/&
&&& &!--show tips by AlertDialog& --&
&&& &Button
&&&&&&& android:id="@+id/tishiAlart"
&&&&&&& android:layout_below="@id/tishiButton"
&&&&&&& android:layout_width="fill_parent"
&&&&&&& android:layout_height="wrap_content"
&&&&&&& android:text="show tips by AlertDialog"/&
&&& &!--AlertDialog : Item选择,类似ListView --&
&&& &Button
&&&&&&& android:id="@+id/AlertItem"
&&&&&&& android:layout_below="@id/tishiAlart"
&&&&&&& android:layout_width="fill_parent"
&&&&&&& android:layout_height="wrap_content"
&&&&&&& android:text="like ListView"/&
&&& &!--AlertDialog : Item选择,类似RadioButton& --&
&&& &Button
&&&&&&& android:id="@+id/AlertSingleChoice"
&&&&&&& android:layout_below="@id/AlertItem"
&&&&&&& android:layout_width="fill_parent"
&&&&&&& android:layout_height="wrap_content"
&&&&&&& android:text="Like RadioButton"/&
&&& &!--AlertDialog : Item选择,类似CheckBox& --&
&&& &Button
&&&&&&& android:id="@+id/AlertCheckBox"
&&&&&&& android:layout_below="@id/AlertSingleChoice"
&&&&&&& android:layout_width="fill_parent"
&&&&&&& android:layout_height="wrap_content"
&&&&&&& android:text="Like CheckBox"/&
&&& &!--AlertDialog : 自定义视图& --&
&&& &Button
&&&&&&& android:id="@+id/customView"
&&&&&&& android:layout_below="@id/AlertCheckBox"
&&&&&&& android:layout_width="fill_parent"
&&&&&&& android:layout_height="wrap_content"
&&&&&&& android:text="CustomView"/&
&/RelativeLayout&
customview.xml[html] view plaincopyprint?
&?xml version="1.0" encoding="UTF-8"?&&
&LinearLayout xmlns:android="/apk/res/android"&
&&& xmlns:tools="/tools"&
&&& android:orientation="vertical"&
&&& android:layout_width="fill_parent"&
&&& android:layout_height="fill_parent"&&
&&& &LinearLayout&&
&&&&&&& android:orientation="horizontal"&
&&&&&&& android:layout_width="fill_parent"&
&&&&&&& android:layout_height="wrap_content"&&
&&&&&&& &TextView&&
&&&&&&&&&&& android:id="@+id/usernameTextView"&
&&&&&&&&&&& android:text="username:"&
&&&&&&&&&&& android:layout_width="wrap_content"&
&&&&&&&&&&& android:layout_height="wrap_content"/&&
&&&&&&& &EditText&&
&&&&&&&&&&& android:id="@+id/usernameEdit"&
&&&&&&&&&&& android:layout_width="fill_parent"&
&&&&&&&&&&& android:layout_height="wrap_content"/&&
&&& &/LinearLayout&&
&&& &LinearLayout&&
&&&&&&& android:orientation="horizontal"&
&&&&&&& android:layout_width="fill_parent"&
&&&&&&& android:layout_height="wrap_content"&&
&&&&&&& &TextView&&
&&&&&&&&&&& android:id="@+id/passwordTextView"&
&&&&&&&&&&& android:text="password:"&
&&&&&&&&&&& android:layout_width="wrap_content"&
&&&&&&&&&&& android:layout_height="wrap_content"/&&
&&&&&&& &EditText&&
&&&&&&&&&&& android:id="@+id/passwordEdit"&
&&&&&&&&&&& android:layout_width="fill_parent"&
&&&&&&&&&&& android:layout_height="wrap_content"/&&
&&& &/LinearLayout&&
&/LinearLayout&&
&?xml version="1.0" encoding="UTF-8"?&
&LinearLayout xmlns:android="/apk/res/android"
&&& xmlns:tools="/tools"
&&& android:orientation="vertical"
&&& android:layout_width="fill_parent"
&&& android:layout_height="fill_parent"&
&&& &LinearLayout
&&&&&&& android:orientation="horizontal"
&&&&&&& android:layout_width="fill_parent"
&&&&&&& android:layout_height="wrap_content"&
&&&&&&& &TextView
&&&&&&&&&&& android:id="@+id/usernameTextView"
&&&&&&&&&&& android:text="username:"
&&&&&&&&&&& android:layout_width="wrap_content"
&&&&&&&&&&& android:layout_height="wrap_content"/&
&&&&&&& &EditText
&&&&&&&&&&& android:id="@+id/usernameEdit"
&&&&&&&&&&& android:layout_width="fill_parent"
&&&&&&&&&&& android:layout_height="wrap_content"/&
&&& &/LinearLayout&
&&& &LinearLayout
&&&&&&& android:orientation="horizontal"
&&&&&&& android:layout_width="fill_parent"
&&&&&&& android:layout_height="wrap_content"&
&&&&&&& &TextView
&&&&&&&&&&& android:id="@+id/passwordTextView"
&&&&&&&&&&& android:text="password:"
&&&&&&&&&&& android:layout_width="wrap_content"
&&&&&&&&&&& android:layout_height="wrap_content"/&
&&&&&&& &EditText
&&&&&&&&&&& android:id="@+id/passwordEdit"
&&&&&&&&&&& android:layout_width="fill_parent"
&&&&&&&&&&& android:layout_height="wrap_content"/&
&&& &/LinearLayout&
&/LinearLayout&
如果您觉得此内容对您有价值,可以点击上面的按钮支持作者,谢谢~
>> 郑重声明:本文由发布,所有内容仅代表个人观点。版权归和共有,欢迎转载, 但未经作者同意必须保留此段声明,并给出文章连接,否则保留追究法律责任的权利! 如果本文侵犯了您的权益,请留言。
推荐您还可以阅读以下内容:
【上一篇】【下一篇】
本站主机由火速提供.主题来自. 151次查询.

我要回帖

更多关于 android toast 边框 的文章

 

随机推荐