自定义radiobutton样式

来源:互联网 发布:锦尚中国的源码怎么样 编辑:程序博客网 时间:2024/06/06 07:54

在src/drawable目录下

新建radio.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">    <item        android:state_checked="false"        android:drawable="@drawable/titles"/>    <item        android:state_checked="true"        android:drawable="@drawable/title"/></selector>
对于选择和非选择设置不同的背景

<RadioButton    android:id="@+id/yy_qingshaonian"    android:layout_width="90dp"    android:layout_height="wrap_content"    android:textSize="18sp"    android:button="@null"    android:background="@drawable/radio"    android:gravity="center"    android:text="青少年" />
把background设置成刚刚那个布局,然后button设置成null去掉前面的圈圈


0 0
原创粉丝点击