做项目的遇到要自定义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]

 

稳定

产品高可用性高并发

贴心

项目群及时沟通

专业

产品经理1v1支持

快速

MVP模式小步快跑

承诺

我们选择声誉

坚持

10年专注高端品质开发
  • 返回顶部