custom_checkbox.xml文件:

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

styles.xml中

    <style name="custom_checkbox" parent="@android:style/Widget.CompoundButton.CheckBox">        <item name="android:button">@drawable/custom_checkbox</item>    </style>

Checkbox:

   <CheckBox          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:checked="true"        android:text="全(不)选"        android:layout_margin="10dip"        android:paddingLeft="10dip"        android:textSize="20sp"        style="@style/custom_checkbox"        android:textColor="@color/black"/> 

备注:

paddingLeft为左边的图标与右边的文字之间的距离

更多相关文章

  1. 为Android应用程序添加两个入口
  2. Android(安卓)Q : 安卓源码、水滴屏适配状态栏图标(图标过多时显
  3. 为Android应用程序添加两个入口
  4. Android权限问题 及 APP应用图标
  5. Android(安卓)res .9.png android九宫图
  6. Android(安卓)系列 5.9使用Inkscape创建Android(安卓)Launcher图
  7. android仿今日头条个人中心页面
  8. SystemUI9.0系统应用图标加载流程
  9. Android获取RecyclerView滑动距离

随机推荐

  1. Android——实现在纯Java代码里写布局
  2. android cts and junit
  3. Android(安卓)kernel printk打印级别
  4. Android(安卓)Studio - Session 'app': E
  5. android修改进入工程模式
  6. Android获取基站坐标代码
  7. android manifest相关属性
  8. Android中的Handler的使用
  9. Android图片放大修改代码
  10. Android之AIDL