首页 > 学院 > 开发设计 > 正文

The usage Color State List Resource

2019-11-09 17:34:31
字体:
来源:转载
供稿:网友

USAGE:

xml file saved at res/color/button_text.xml

<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android">    <item android:state_PRessed="true"          android:color="#ff1bb5d7"/> <!-- pressed -->    <item android:state_focused="true"          android:color="#ff0000ff"/> <!-- focused -->    <item android:color="#ff000000"/> <!-- default --></selector>This layout XML will apply the color list to a View:

<Button    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:text="@string/button_text"    android:textColor="@color/button_text" />


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表