Android 自定义CheckBox复选框
2017-04-06 19:38
441 查看
Android 自定义CheckBox复选框
效果图
1.首先在drawable文件夹中添加drawable文件checkbox_style.xml。
在这里我是用了空心圆和实心圆图片,如果想换别的可以自行更改
2.在布局文件中使用background使用自定义checkbox样式。
在这里Visibility属性详解主要用来设置控制控件的显示和隐藏。
详解可以参考:Android Visibility使用详解
android:button=“@null”设置复选框为空
效果图
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/yuan_f" android:state_checked="false"/> <item android:drawable="@drawable/yuan_t" android:state_checked="true"/> </selector>
2.在布局文件中使用background使用自定义checkbox样式。
<CheckBox android:visibility="gone" android:id="@+id/checkboxone" android:background="@drawable/selector" android:button="@null" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
在这里Visibility属性详解主要用来设置控制控件的显示和隐藏。
详解可以参考:Android Visibility使用详解
android:button=“@null”设置复选框为空
相关文章推荐
- Android 自定义CheckBoxPreference的CheckBox复选框
- Android之自定义checkbox并解决内容和复选框之间的具体问题
- Android 自定义CheckBoxPreference的CheckBox复选框
- android 自定义checkbox 大小 图片
- 如何自定义带checkbox的Android ListView
- android中自定义checkbox大小和图片
- android UI学习 -- 设置界面的布局(包括style的使用,selector的使用,Checkbox自定义样式,菜单项的样式)
- 第7章、单选按钮RadioGroup与复选框CheckBox(从零开始学Android)
- Android入门逆引手册 - 06 复选框(CheckBox)的使用
- 【WPF】自定义CheckBox复选框
- android自定义listview,添加监听器,解决屏幕滑动组件状态干扰的问题checkbox ...
- Android UI控件之CheckBox(复选框、多选框)
- android CheckBox 自定义样式
- Android开发之ListView,加入CheckBox(复选框),实现选择列表
- Android中自定义checkbox样式
- Android的UI组件复选框控件CheckBox
- Android 各控件的使用 - 复选框(CheckBox)
- android中自定义checkbox大小和图片
- Android 自定义CheckBox 样式
- android中自定义checkbox大小和图片