1. android:button="@null" 可以屏蔽CheckBox的选择框
2.android:textColor="@drawable/selector_text_color" 文本text 设置selectColor
效果图:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/dp_36" android:layout_marginRight="@dimen/dp_36" android:orientation="vertical"> <CheckBox android:id="@+id/course_checkbox" android:layout_width="match_parent" android:layout_height="@dimen/edit_box_height" android:layout_marginTop="@dimen/dp_10" android:gravity="center" android:button="@null" android:background="@drawable/selector_btn_checkbox" android:textColor="@drawable/selector_text_color" android:textSize="@dimen/sp_18" android:text="课程类" /> <CheckBox android:id="@+id/article_checkbox" android:layout_width="match_parent" android:layout_height="@dimen/edit_box_height" android:layout_marginTop="@dimen/dp_10" android:gravity="center" android:button="@null" android:background="@drawable/selector_btn_checkbox" android:textColor="@drawable/selector_text_color" android:textSize="@dimen/sp_18" android:text="文章类" /> </LinearLayout>
drawable/selector_text_color.xml
复制代码
1
2
3
4
5
6
7<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="@color/colorAccent" android:state_checked="true"/> <item android:color="#ff979797" android:state_checked="false" /> </selector>
同样适用于 RadioButton
最后
以上就是愤怒雨最近收集整理的关于Android CheckBox设置背景selector和文本text 设置selectColor的全部内容,更多相关Android内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复