Created
January 22, 2012 06:07
-
-
Save aztack/1655858 to your computer and use it in GitHub Desktop.
choice dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//图3效果:信息内容是一个简单的View类型 | |
new AlertDialog.Builder(this).setTitle("请输入").setIcon( | |
android.R.drawable.ic_dialog_info).setView( | |
new EditText(this)).setPositiveButton("确定", null) | |
.setNegativeButton("取消", null).show(); | |
//信息内容是一组单选框 | |
new AlertDialog.Builder(this).setTitle("复选框").setMultiChoiceItems( | |
new String[] { "Item1", "Item2" }, null, null) | |
.setPositiveButton("确定", null) | |
.setNegativeButton("取消", null).show(); | |
//信息内容是一组多选框 | |
new AlertDialog.Builder(this).setTitle("单选框").setIcon( | |
android.R.drawable.ic_dialog_info).setSingleChoiceItems( | |
new String[] { "Item1", "Item2" }, 0, | |
new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int which) { | |
dialog.dismiss(); | |
} | |
}).setNegativeButton("取消", null).show(); | |
//信息内容是一组简单列表项 | |
new AlertDialog.Builder(this).setTitle("列表框").setItems( | |
new String[] { "Item1", "Item2" }, null).setNegativeButton( | |
"确定", null).show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment