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 Q : 安卓源码、水滴屏适配状态栏图标(图标过多时显示一个
  2. Android权限问题 及 APP应用图标
  3. Android 系列 5.9使用Inkscape创建Android Launcher图标
  4. Android获取RecyclerView滑动距离
  5. SystemUI9.0系统应用图标加载流程
  6. Android百度地图SDK—地图标记
  7. android中求区域内两个坐标之间的距离的实现
  8. android editText 软键盘enter键图标的设置
  9. react-native APP图标和Splash(Android)

随机推荐

  1. android database SQL language
  2. Android背景透明的 Dialog
  3. Android触屏事件处理流程浅析
  4. Android内存监听的方法
  5. 浅析移动开发
  6. 通过aidl service调用activity
  7. android apk 应用 重新签名 方法
  8. Android(安卓)开发艺术探索读书笔记 9 --
  9. Android版本管理(git 和 repo)
  10. arcgis for android 学习 - (4) 了解mapV