Android 自定义 RadioButton 去除无谓的背景空白实例
来源:互联网 发布:php cookie 登陆 编辑:程序博客网 时间:2024/04/29 16:22
做项目的遇到要自定义RadioButton的样式,在网上搜索了很多例子都没有完美解决,
当android:button="@null"的是时候但它的位置还在,空出了很大一块,横向排列的时候不是很美观。
试了很多办法终于解决了这个小问题就是把背景也设为"@null" 这样:android:background="@null" ,
就可以了 它的也就没有了 空出的很大部分也没有了。
显示效果:(比较紧凑了,不会像原来那样每个button间间隔开很多)
全部代码:
- <RadioGroup
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:orientation="horizontal"
- android:paddingBottom="15dp"
- android:paddingTop="15dp" >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="5dp"
- android:text="保额"
- android:textColor="#363636"
- android:textSize="18sp" />
- <RadioButton
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="5dp"
- android:background="@null"
- android:button="@null"
- android:drawableLeft="@drawable/radio_selector"
- android:singleLine="true"
- android:text="10万"
- android:textColor="#2991a5"
- android:textSize="18sp" />
- <RadioButton
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="5dp"
- android:background="@null"
- android:button="@null"
- android:drawableLeft="@drawable/radio_selector"
- android:singleLine="true"
- android:text="20万"
- android:textColor="#2991a5"
- android:textSize="18sp" />
- <RadioButton
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="5dp"
- android:background="@null"
- android:button="@null"
- android:drawableLeft="@drawable/radio_selector"
- android:singleLine="true"
- android:text="50万"
- android:textColor="#2991a5"
- android:textSize="18sp" />
- <RadioButton
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="5dp"
- android:background="@null"
- android:button="@null"
- android:drawableLeft="@drawable/radio_selector"
- android:singleLine="true"
- android:text="100万"
- android:textColor="#2991a5"
- android:textSize="18sp" />
- </RadioGroup>
0 0
- Android 自定义 RadioButton 去除无谓的背景空白实例
- Android 自定义 RadioButton 去除无谓的背景空白实例
- Android RadioButton使用自定义背景
- Android RadioButton的自定义
- android自定义的RadioButton
- android 自定义Dialog去除黑色背景
- 自定义RadioButton样式并去除默认样式位置【Android】
- Android 自定义RadioButton的样式
- Android 自定义RadioButton的样式
- Android 自定义RadioButton的样式
- Android 自定义RadioButton的样式
- Android 自定义RadioButton的样式
- 每天一个JavaScript实例-去除字符串末尾的空白
- RadioButton - android 自定义RadioButton样式
- 更改RadioButton的背景
- Android 自定义dialog,去除系统默认黑色背景,边框并设置dialog的显示位置
- android的自定义样式的radiobutton
- Android之自定义RadioButton的样式
- 初识阿里云SLB负载均衡
- java高并发访问及队列控制解决方案
- Revit 2015 发布!
- 怎样提高网站的用户体验
- 微软面试:k-th string
- Android 自定义 RadioButton 去除无谓的背景空白实例
- 船长逃生后在地上晾晒纸钞 大喊“钱是我的”
- Android 改变AlertDialog中View字体的大小
- Android的Bluetooth Profile与UUID
- 10道XML面试题
- android Android.mk的编写 基本知识
- ActiveMQ入门实例
- linux下定时执行mysql备份
- 鼠标滑过弹出层