1. 首先创建自定义样式文件

    <?xml version="1.0" encoding="utf-8"?>        
  2. 通过 CheckBox 的 android:button 属性设置样式时,在低版本设备上,原始的 CheckBox 背景仍会占据空间,导致 CheckBox 占据的空间比按钮图片大。如果设置 android:background="@null" 去除原始背景,又会导致 CheckBox 长宽为零不展示。

  3. 考虑直接用 android:background 属性设置样式,并设置 android:button="@null"。结果显示的按钮图片被拉伸。

  4. 研究 api 发现另一种途径,使用 android:drawableLeft 属性设置样式,并设置 android:background="@null"android:button="@null",最终解决问题。xml 文件如下:

更多相关文章

  1. RelativeLayout_相对布局 属性的描述
  2. 用PHP编写Android应用程序
  3. 相对布局各种属性说明
  4. shape的使用总结
  5. android中控制EditText不可编辑的问题
  6. android设置Activity背景色为透明的2种方法
  7. 【Android布局】在程序中设置android:gravity 和 android:layout
  8. Android中横竖屏切换的问题
  9. Android中Shape和Selector的结合使用。

随机推荐

  1. [置顶] 给Android应用开发者的十个建议
  2. Android材料设计兼容函数库(Design Suppor
  3. Android性能优化之系统显示原理
  4. android 测量控件视图的方法
  5. 2016年 代做安卓毕业设计 Android毕业设
  6. [置顶] android实现向右滑动返回功能
  7. Android上利用SDK的BluetoothAPI实现传送
  8. Android(安卓)的网络判定(网络连接类型和
  9. Android(安卓)使用MVPHelper工具生成,MVPD
  10. Android(安卓)关于接口回调原理的解析