RadioButton 多行 多列显示
来源:互联网 发布:windows和linux的区别 编辑:程序博客网 时间:2024/06/03 23:38
布局:
<RadioGroup android:id="@+id/rg_first" style="@style/rg_style" android:orientation="horizontal"> <RadioButton android:id="@+id/pay_issue" style="@style/rg_rb_style" android:text="@string/pay_issue" /> <RadioButton android:id="@+id/cannot_play" style="@style/rg_rb_style" android:text="@string/cannot_play" /> </RadioGroup> <RadioGroup android:id="@+id/rg_second" style="@style/rg_style" android:orientation="horizontal"> <RadioButton android:id="@+id/force_closure" style="@style/rg_rb_style" android:text="@string/force_closure" /> <RadioButton android:id="@+id/play_pause" style="@style/rg_rb_style" android:text="@string/play_pause" /> </RadioGroup> <RadioGroup android:id="@+id/rg_third" style="@style/rg_style" android:orientation="horizontal"> <RadioButton android:id="@+id/other_issues" style="@style/rg_rb_style" android:text="@string/other_issues" /> </RadioGroup>
Java:
public class FeedBackActivity extends BaseActivity implements RadioGroup.OnCheckedChangeListener{ private RadioGroup firstRG; private RadioGroup secondRG; private RadioGroup thirdRG; public static Intent getFeedBackActivityIntent(Context context){ Intent feedBackIntent = new Intent(context, FeedBackActivity.class); return feedBackIntent; } @Override protected int getLayoutId() { return R.layout.aty_feed_back; } @Override protected void afterCreate() { firstRG = (RadioGroup) findViewById(R.id.rg_first); secondRG = (RadioGroup) findViewById(R.id.rg_second); thirdRG = (RadioGroup) findViewById(R.id.rg_third); firstRG.setOnCheckedChangeListener(this); secondRG.setOnCheckedChangeListener(this); thirdRG.setOnCheckedChangeListener(this); } @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if(group != null && checkedId>0){ if(group == firstRG){ secondRG.clearCheck(); thirdRG.clearCheck(); }else if(group == secondRG){ firstRG.clearCheck(); thirdRG.clearCheck(); }else if(group == thirdRG){ firstRG.clearCheck(); secondRG.clearCheck(); } group.check(checkedId); } }}
color.xml:
<style name="rg_style"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> </style> <style name="rg_rb_style"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_weight">1</item> </style>
效果图:
0 0
- RadioButton 多行 多列显示
- GridView RadioButton 样板列
- RadioGroup的多行显示RadioButton
- 多列显示
- fieldSet多列显示
- css-多列显示
- combobox 多列显示
- ListView/GridView 双列/多列显示
- 利用RecyclerView实现动态添加RadioButton多行显示
- repeater实现多列显示
- SQL SERVER 多列显示
- fieldset 多列显示 extjs
- Combox 下拉显示多列
- repeater 一行显示多列
- 显示多列的ComboBox
- matlab多列显示图例
- DataList 并排显示多列
- RadioButton中无法显示图片?
- 【9704】&&【9109】麦森数
- 设计模式之备忘录模式
- Reactor Proactor模型 epoll模型
- Java中获取明天或者昨天的日期的方法
- 41.计算两个时间之间的间隔时间
- RadioButton 多行 多列显示
- cin>> , cin.getline() 的区别 ,cin.ignore() 缓冲区等知识深入
- HyperPacer之一键式分析报告
- 习题9 打印,打印,打印
- mac配置tomcat的一些问题
- db2 aix 定时 备份
- 有点用的小技巧
- Objective-C Category 的实现原理
- 移动支付——支付宝