赞
踩
Android如何自定义RadioButton的样式
1.在drawable文件夹下定义样式
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/reason_radio_btn_img_sel" android:state_checked="true" android:state_enabled="true"></item>
<item android:drawable="@mipmap/reason_readio_btn_nor" android:state_checked="false" android:state_enabled="true"></item>
</selector>
<style name="RadioButtonStyles">
<item name="android:button">@drawable/reason_radiobtn_style</item>
</style>
<RadioButton
android:id="@+id/item_reason_radio_btn"
style="@style/RadioButtonStyles"
android:layout_width="@dimen/dimen_22dp"
android:layout_height="@dimen/dimen_22dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>;
这样RadioButton就可以达到你想要的效果了。
技术共享群:195109527
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。