首先 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="#ffff0000"/> <!-- 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="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_text"
android:textColor="@color/button_text" />自己看着例子写吧。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:color="#ffff0000"/> <!-- 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="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_text"
android:textColor="@color/button_text" />自己看着例子写吧。
解决方案 »
- 一个很纠结的问题,希望大家帮下忙。谢谢了。。。。
- 关于从PC上接受实时数据的问题
- android opengl 画平面图形,出不来。。。求救。。。
- eclipse加载源程序出错,说我没有android-5,我该怎么办?
- Bionic Libc中close(fd)函数的实现位置
- android源代码中一个很疑惑的问题
- trustdroid,xmandroid,crossdroid,scandroid,droidbox等等这些是开源的吗,源代码到哪里下载?
- 分享在广州干android的工资
- android 微信 分享
- 急求队友,大学生互联网+比赛
- Listview 探讨
- 请教:为什么android签名后,放到手机上装会显示解析软件包时出现问题
另一个中是过滤颜色。