android系统自带单选Dialog

String[] data=new String[]{"中国","美国","俄罗斯"};
int default_index=0;//默认选中的位置
new AlertDialog.Builder(TestActivity.this).setTitle("").setSingleChoiceItems(R.array.country, default_index, new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int item) {
				dialog.dismiss();
				tv_country.setText(data[item]);
			}
		}).show();
发布了22 篇原创文章 · 获赞 2 · 访问量 472

猜你喜欢

转载自blog.csdn.net/m0_37782318/article/details/105218208