2011.09.01(5)——— android checkbox自定义样式

参考:http://gundumw100.iteye.com/blog/1025176

drawable/checkbox.xml

<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"><item android:state_checked="true" android:drawable="@drawable/checkbox_checked" /><!--选中时效果 --><item android:state_checked="false" android:drawable="@drawable/checkbox_unchecked" /><!--未选中时效果 --></selector> 



values/styles.xml
<?xml version="1.0" encoding="utf-8"?><resources><style name="MyCheckBox" parent="@android:style/Widget.CompoundButton.CheckBox"><item name="android:button">@layout/checkbox_selector</item><item name="android:paddingLeft">25.0dip</item><item name="android:maxHeight">10.0dip</item></style></resources>


layout.xml

<CheckBox android:layout_marginLeft="15dp"android:layout_marginRight="20dp" android:layout_marginTop="3dp"android:layout_marginBottom="0dp" android:id="@+id/setting_amrbitrate_low"android:checked="false" android:layout_width="40dp"android:layout_height="22dp" android:text="" android:textColor="#000000"style="@style/MyCheckBox" android:textStyle="bold"android:layout_alignParentRight="true" />




更多相关文章

  1. Android Studio -- 设置字体样式
  2. Android 中可重写的一些样式
  3. Android样式的开发:drawable汇总篇
  4. Android中的自定义主题和样式
  5. Android系统自带样式(android:theme)(stephen830的博客)
  6. 设置 listview 滚动条样式
  7. android switch 控件自定义样式不显示??
  8. ProgressBar 样式

随机推荐

  1. Android(安卓)布局之LinearLayout和Relat
  2. 布局中文件中【控件间距参数详解以及单位
  3. Android启动脚本init.rc
  4. 如果让我重新设计一款Android(安卓)App
  5. React Native 调用原生Android/iOS代码实
  6. Android(安卓)Animation学习
  7. Android(安卓)WebView 用法
  8. Android(安卓)TextView属性详解
  9. Android—TextView的XML属性和方法
  10. 浅谈android的selector,背景选择器