自定义RadioButton样式并去除默认样式位置
做项目的遇到要自定义RadioButton的样式,在网上搜索了很多例子都没有完美解决,当android:button="@null"的是时 候但它的位置还在,空出了很大一块,横向排列的时候不是很美观。试了很多办法终于解决了这个小问题就是把背景 也 设 为"@null" 这样:android:background="@null" ,就可以了 它的也就没有了 空出的很大部分也没有 了。
全部代码:
[mw_shl_code=xhtml,true]android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:paddingBottom="15dp"
android:paddingTop="15dp" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:text="保额"
android:textColor="#363636"
android:textSize="18sp" />
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" />
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" />
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" />
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" />
[/mw_shl_code]
推荐文章
2025-01-18
2024-11-28
2024-11-09
2024-10-25
2024-06-25
2024-01-04
2023-11-06
2023-10-30
2023-10-13
2023-10-10
稳定
产品高可用性高并发贴心
项目群及时沟通专业
产品经理1v1支持快速
MVP模式小步快跑承诺
我们选择声誉坚持
10年专注高端品质开发