<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/dialog"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/choice1"
android:textColor="@color/green"
android:textSize="@dimen/text"/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/radiogroup1">
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/kind"
android:id="@+id/radio1"
android:checked="true"
/>
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/attribute"
android:id="@+id/radio2"/>
</RadioGroup>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/choice2"
android:textColor="@color/green"
android:textSize="@dimen/text"/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/radiogroup2">
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/area"
android:id="@+id/radio3"
android:checked="true"/>
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/count"
android:id="@+id/radio4"/>
</RadioGroup>
</LinearLayout>
LayoutInflater layoutInflater = LayoutInflater.from(MainPlan.this);
View self = layoutInflater.inflate(R.layout.multichoicedialog, null);//引入对话框布局
final RadioGroup radioGroup1 = (RadioGroup) self.findViewById(R.id.radiogroup1);
final RadioGroup radioGroup2 = (RadioGroup) self.findViewById(R.id.radiogroup2);
new AlertDialog.Builder(MainPlan.this)//MainPlan是当前activity
.setView(self)
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
dialog.dismiss();
}
})
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (radioGroup1.getCheckedRadioButtonId() == R.id.radio1) {
if (radioGroup2.getCheckedRadioButtonId() == R.id.radio3) {
} else {//处理各种事件
}
} else {
if (radioGroup2.getCheckedRadioButtonId() == R.id.radio3) {
} else {
}
}
}
})
.show();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有