背景:

android中缺省的checkbox,有时显得较小,而且经常会与界面设计风格不一致,因此通过定制checkbox可以设计成自已想要的风格。


方法:

一. 首先我们要确定checkbox的checked与unchecked两种状态。用图片表示:

二. 编写custom_checkbox_design.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/checked" />
<item android:state_checked="false" android:drawable="@drawable/unchecked" />

</selector>


三.调用

android:button="@drawable/custom_checkbox_design"

更多相关文章

  1. [置顶] 整理最全的Android开发工程师面试题,面试题详解。java、An
  2. Android(安卓)HDecoration项目so库导出和调用
  3. onPrepareOptionsMenu 和onCreateOptionsMenu 的区别
  4. 编写高效的Android代码(Designing for Performance)
  5. android Retrofit+OKhttp实现接口调用
  6. 成佩涛编程之路——android之jquery使用(二)
  7. OMG,终于解决了IntelliJ IDEA配合Android和gradle时出现Unsupport
  8. Android(安卓)View的事件传递机制
  9. 深入研究Android事件传递与重绘

随机推荐

  1. Android布局控件的继承关系
  2. Android聊天软件开发(基于网易云IM即时通
  3. Android中网络判断
  4. 【android】recycleview小整理
  5. Android P2P语音通话实现
  6. android: content URI的真实路径获取
  7. android 颜色16进制对应的xml配置值(工具
  8. android studio 引入另一个XML文件的布局
  9. Android 禁止下拉通知栏
  10. LinearLayout中控件不能居右对齐