Android复选框对话框用法实例简析
本文实例分析了Android复选框对话框用法。分享给大家供大家参考,具体如下:
/** *创建筛选复选框对话框 *@paramguoguanglist联赛名 *@paramflags是否选择 *@create_time2011-10-26下午3:59:54 */ privatevoidinitFilterDialog(String[]iNamelist,finalboolean[]iFlags){ Builderbuilder=newandroid.app.AlertDialog.Builder(this); builder.setTitle("筛选赛事"); builder.setMultiChoiceItems(iNamelist,iFlags,newDialogInterface.OnMultiChoiceClickListener(){ publicvoidonClick(DialogInterfacedialog,intwhich,booleanisChecked){ leagueNameChoice[which]=isChecked; } }); //添加一个确定按钮 builder.setPositiveButton("确定",newDialogInterface.OnClickListener(){ publicvoidonClick(DialogInterfacedialog,intwhich){ filterLeagueNameResult(); } }); builder.setNegativeButton("关闭",newDialogInterface.OnClickListener(){ publicvoidonClick(DialogInterfacedialog,intwhich){ } }); //创建一个复选框对话框 dialog=builder.create(); dialog.show(); }
希望本文所述对大家Android程序设计有所帮助。