1 回答

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超5個(gè)贊
您可以使用 view.setVisibility(View.Visible 或 View.Gone)控制每個(gè)視圖的可見性。在單選按鈕上設(shè)置單擊偵聽器,并使用該方法顯示帶有單選按鈕的容器布局。
chkIos.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (v.isChecked()) {
multiChoiceView.setVisibility(View.VISIBLE);
} else {
multiChoiceView.setVisibility(View.GONE);
}
});
要在您的圖片上構(gòu)建布局,您可以在每個(gè) RadioButton 下將 RadioGroup 與 LinearLayout 結(jié)合起來,以這種方式:
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:orientation="vertical">
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RadioGroup>
添加回答
舉報(bào)