xml定义文字状态颜色
发布时间:2020-12-16 08:29:03 所属栏目:百科 来源:网络整理
导读:文字根据状态更改颜色 android:textColor(放在res/color/目录下) selector xmlns:android = "http://schemas.android.com/apk/res/android" item android:color = "#53c1bd" android:state_selected = "true" / item android:color = "#53c1bd" android:stat
文字根据状态更改颜色 android:textColor(放在res/color/目录下) <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#53c1bd" android:state_selected="true"/>
<item android:color="#53c1bd" android:state_focused="true"/>
<item android:color="#53c1bd" android:state_pressed="true"/>
<item android:color="#777777"/>
</selector>
背景色根据状态更改颜色 android:backgroup(如果直接给背景色color会报错) <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true"><shape>
<gradient android:angle="0" android:centerColor="#00a59f" android:endColor="#00a59f" android:startColor="#00a59f" />
</shape></item>
<item android:state_focused="true"><shape>
<gradient android:angle="0" android:centerColor="#00a59f" android:endColor="#00a59f" android:startColor="#00a59f" />
</shape></item>
<item android:state_pressed="true"><shape>
<gradient android:angle="0" android:centerColor="#00a59f" android:endColor="#00a59f" android:startColor="#00a59f" />
</shape></item>
<item><shape>
<gradient android:angle="0" android:centerColor="#00ff00" android:endColor="00ff00" android:startColor="00ff00" />
</shape></item>
</selector>
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |