Android 自定义CheckBox样式
来源:互联网 发布:网络课程哪个好 编辑:程序博客网 时间:2024/05/27 16:43
原文地址:https://www.cnblogs.com/Claire6649/p/5941145.html
1.首先在drawable文件夹中添加drawable文件checkbox_style.xml。
1 <selector xmlns:android="http://schemas.android.com/apk/res/android" > 2 <item 3 android:drawable="@drawable/sel_check" 4 android:state_checked="true"/> 5 <item 6 android:drawable="@drawable/sel_nor" 7 android:state_checked="false"/> 8 <item 9 android:drawable="@drawable/sel_nor"/>10 11 </selector>
2.在values文件夹下的styles.xml文件中添加CustomCheckboxTheme样式。
1 <!-- CustomCheckBox theme -->2 <style name="CustomCheckBoxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">3 <item name="android:button">@drawable/checkbox_style</item> 4 </style>
3.在布局文件中使用CustomCheckBoxTheme样式。
1 <CheckBox2 android:id="@+id/tv_upper"3 android:layout_width="wrap_content"4 android:layout_height="wrap_content"5 android:gravity="center_vertical"6 style="@style/CustomCheckBoxTheme" />
使用到的图片资源
sel_check.png
sel_nor.png
阅读全文
0 0
- android CheckBox 自定义样式
- Android 自定义CheckBox 样式
- android 自定义checkbox 样式
- Android 自定义CheckBox样式
- Android自定义checkbox样式
- android 自定义checkbox 样式
- 自定义Checkbox样式--Android
- Android 自定义CheckBox 样式
- Android自定义CheckBox样式
- android自定义checkBox样式
- Android 自定义checkbox样式
- Android 自定义CheckBox样式
- Android 自定义CheckBox样式
- Android中自定义checkbox样式
- Android中自定义checkbox样式
- android中checkbox自定义样式
- Android 自定义Checkbox显示样式
- Android中自定义checkbox样式
- mysql mireadb access denied
- Floyed算法实现最短路径
- 有效地使用模拟信号条件反射将传感器与处理器匹配---凯利讯半导体
- 如何降低在 npm 模块中发布敏感信息的可能性
- Linux系统下Libinput驱动的应用(主要在触摸屏校准)
- Android 自定义CheckBox样式
- MacOS Navicat Premium v10.1.1 for Mac 破解版
- MySql-创建触发器
- Codeforces Round #450 (Div. 2)+刘汝佳紫书3-8 (C语言整数模拟除法)
- 偏门套路:每天被动吸引150+精准淘宝粉
- 强化学习(Reinforcement Learning)
- ArrayList集合
- Angular中,数据更改自动加载页面
- Android 屏幕适配相关知识