本文实例分析了Android复选框对话框用法。分享给大家供大家参考,具体如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/** * 创建筛选复选框对话框 * @param guoguanglist 联赛名 * @param flags 是否选择 * @create_time 2011-10-26 下午3:59:54 */ private void initFilterDialog(String[] iNamelist, final boolean [] iFlags) { Builder builder = new android.app.AlertDialog.Builder( this ); builder.setTitle( "筛选赛事" ); builder.setMultiChoiceItems(iNamelist, iFlags, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int which, boolean isChecked) { leagueNameChoice[which] = isChecked; } }); //添加一个确定按钮 builder.setPositiveButton( "确定" , new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { filterLeagueNameResult(); } }); builder.setNegativeButton( "关闭" , new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); //创建一个复选框对话框 dialog = builder.create(); dialog.show(); } |
希望本文所述对大家Android程序设计有所帮助。