/*** * 课程类型选择 */ private void work2() { int so = 0;//选择状态 String net1 = enter3.getText().toString();//显示控件 switch (net1){ case "全部证书": so = 0; break; case "基础": so = 1; break; case "初级": so = 2; break; case "中级": so = 3; break; case "专项": so = 4; break; } new AlertDialog.Builder(this).setTitle("证书等级选择").setSingleChoiceItems( new String[] {"全部证书","基础", "初级", "中级", "专项" },so, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which){ case 0: enter3.setText("全部证书"); break; case 1: enter3.setText("基础"); break; case 2: enter3.setText("初级"); break; case 3: enter3.setText("中级"); break; case 4: enter3.setText("专项"); break; } dialog.dismiss(); } }).setNegativeButton("取消", null).show(); }
简单实现Android自带的集合单项对话框
最新推荐文章于 2019-11-20 22:07:28 发布