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 AndroidManifest.xml命名空间报错问题
  2. widget(5、DatePicker)
  3. Android样式的开发:drawable汇总篇
  4. Android(安卓)中可重写的一些样式
  5. 9.RatingBar
  6. android-RadioButton背景使用图片
  7. 如何关联androidSDK源代码
  8. listview android:cacheColorHint,android:listSelector属性作用
  9. Android中的自定义主题和样式

随机推荐

  1. Android 播放MP4文件
  2. Android高版本不兼容低版本gradle问题
  3. Android(安卓)利用addView 让Activity 动
  4. android中gps的打开关闭
  5. 安卓AS打包报错org.gradle.process.inter
  6. Android加载Gif动画实现代码
  7. VirtualBox下使用Ubuntu 虚拟机Android
  8. Android Studio error: Unable to start
  9. Android(安卓)Intent初步试用
  10. Android中把assets目录下所有图片转换成b