注意

1.选择框图片9.png格式无效,无法自动根据字体改变大小

2.自定义button控件是改变

android:background="@drawable/button_skin"
自定义多选框是改变
style="@style/CustomCheckboxTheme"

以下3步只需要修改高亮部分


1.首先在drawable文件夹中添加drawable文件checkbox_style.xml。

<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android">    <item android:drawable="@drawable/check_normal_9" android:state_checked="false" />    <item android:drawable="@drawable/check_select_9" android:state_checked="true" />selector>

   
2.在values文件夹下的styles.xml文件中添加CustomCheckboxTheme样式。

[html]  view plain copy
  1. <style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">  
  2.     <item name="android:button">@drawable/checkbox_styleitem>  
  3. style>  
3.在布局文件中使用CustomCheckboxTheme样式。

[html]  view plain copy
  1. <CheckBox  
  2.         android:id="@+id/cb_all"  
  3.         android:layout_width="wrap_content"  
  4.         android:layout_height="wrap_content"  
  5.         style="@style/CustomCheckboxTheme" />  

效果如下(图片资源可以自定义)


更多相关文章

  1. Android 导入android源码有错,R.java文件不能自动生成解决方法
  2. 自定义SeekBar样式
  3. Android dex ,xml 文件反编译方法
  4. android/java 计算大文件的sha1值
  5. 【Android 设计】:样式_ 图解
  6. Android开发的文件格式概述

随机推荐

  1. rollup是面向library的?!
  2. lerna入门指南
  3. react-redux源码解读
  4. Web Components
  5. 微信公众号自动回复图文消息
  6. JAVA虚拟机体系结构
  7. 最近厚着脸皮联系了不少同学
  8. 学C语言和学C++它有毛关系吗?
  9. GitHub还真把所有代码埋到北极地下了,我特
  10. ssm实战购物商城系统