猿问
回到首页
个人中心
反馈问题
注册登录
下载APP
首页
课程
实战
体系课
手记
专栏
慕课教程
如何在 Android 中单击 Single Chocie 时出现的多选选项
我想要这样的东西。在所有单项选择下方可能有被动多选按钮。没关系。那可能吗?
喵喵时光机
浏览 156
回答 1
1回答
四季花海
您可以使用 view.setVisibility(View.Visible 或 View.Gone)控制每个视图的可见性。在单选按钮上设置单击侦听器,并使用该方法显示带有单选按钮的容器布局。chkIos.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View view) { if (v.isChecked()) { multiChoiceView.setVisibility(View.VISIBLE); } else { multiChoiceView.setVisibility(View.GONE); }});要在您的图片上构建布局,您可以在每个 RadioButton 下将 RadioGroup 与 LinearLayout 结合起来,以这种方式:<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>
0
0
0
打开App,查看更多内容
随时随地看视频
慕课网APP
相关分类
Java
继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续