Android中RadioGroup的多行多列,以及互斥监听
来源:互联网 发布:华为p9 plus优化 编辑:程序博客网 时间:2024/06/07 15:19
<LinearLayout
android:layout_width="wrap_content"android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:orientation="horizontal" >
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:text="缴费方式" />
<com.dtcloudpicclifenew.baseproject.base.MyRadioGroup
android:id="@+id/carefree_paymenthod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/carefree_trial_payment_methold_one"
android:layout_width="50dp"
android:layout_height="26dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:background="@drawable/million_trial_select_back"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="5年"
android:textColor="@color/Color_btn_select"
android:textSize="@dimen/text_select_size" />
<RadioButton
android:id="@+id/carefree_trial_payment_methold_two"
android:layout_width="50dp"
android:layout_height="26dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:background="@drawable/million_trial_select_back"
android:button="@null"
android:gravity="center"
android:text="10年"
android:textColor="@color/Color_btn_select"
android:textSize="@dimen/text_select_size" />
<RadioButton
android:id="@+id/carefree_trial_payment_methold_tree"
android:layout_width="50dp"
android:layout_height="26dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:background="@drawable/million_trial_select_back"
android:button="@null"
android:gravity="center"
android:text="15年"
android:textColor="@color/Color_btn_select"
android:textSize="@dimen/text_select_size" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/carefree_trial_payment_methold_four"
android:layout_width="50dp"
android:layout_height="26dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:background="@drawable/million_trial_select_back"
android:button="@null"
android:gravity="center"
android:text="20年"
android:textColor="@color/Color_btn_select"
android:textSize="@dimen/text_select_size" />
<RadioButton
android:id="@+id/carefree_trial_payment_methold_five"
android:layout_width="50dp"
android:layout_height="26dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:background="@drawable/million_trial_select_back"
android:button="@null"
android:gravity="center"
android:text="30年"
android:textColor="@color/Color_btn_select"
android:textSize="@dimen/text_select_size" />
<RadioButton
android:id="@+id/carefree_trial_payment_methold_onece"
android:layout_width="70dp"
android:layout_height="26dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/million_trial_select_back"
android:button="@null"
android:gravity="center"
android:text="一次缴清"
android:textColor="@color/Color_btn_select"
android:textSize="@dimen/text_select_size" />
</LinearLayout>
</com.dtcloudpicclifenew.baseproject.base.MyRadioGroup>
</LinearLayout>
效果如下图所示
另,这样设置好布局后,每点击一个都会选中,不能得到想要的单选效果,这就需要自定义RadioGroup形成互斥,我也是参考下面链接来写的,很好用
http://jasonshieh.iteye.com/blog/1972131
阅读全文
0 0
- Android中RadioGroup的多行多列,以及互斥监听
- Android RadioGroup的监听
- RadioGroup中RadioButton不能互斥
- radioGroup中radiobutton不能互斥问题
- radioGroup的点击监听
- Android中RadioGroup的用法
- RadioGroup中的RadioButton互斥
- Android中在弹窗中使用RadioGroup踩的坑,以及使用shareSDK分享的关键性代码
- Android中RadioGroup和Fragment的应用
- Android中Preference的使用以及监听事件分析
- Android中Preference的使用以及监听事件分析
- Android中Preference的使用以及监听事件分析
- Android中Preference的使用以及监听事件分析
- Android中Preference的使用以及监听事件分析
- Android中Preference的使用以及监听事件分析
- Android中Preference的使用以及监听事件分析
- Android中Preference的使用以及监听事件分析
- Android中Preference的使用以及监听事件分析
- JQuery中serialize()、serializeArray()和param()方法示例介绍
- JAVA 定时启动
- ubuntu openblas
- hadoop之文件系统HA搭建的部署细节
- mysql cluster
- Android中RadioGroup的多行多列,以及互斥监听
- 028_实战EXE和SYS通信-28课(缓冲模式)_exe_控制台
- 图像处理基本算法 车牌识别与定位
- javascript——移动端input,textarea输入框获得焦点页面上移
- POJ 1083(水题)
- c++电话薄
- QT学习笔记(1)
- 名企笔试:2016网易笔试题(奖学金)2017-05-12 算法爱好者
- springboot 添加静态页面