首先 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" />自己看着例子写吧。
解决方案 »
- 多个Animation 同时运行问题
- 为什么NDK(android-ndk-r5b)编译总是找不到头文件
- listview嵌套gridview
- 有个表格,每个列的宽度都不同,用什么控件实现啊?
- 请教高手高手高高手一个问题!!!!!!!!
- 请问如何在Android程序中实现来电转移功能??
- ERROR:Attempting to call cordova.exec() before 'deviceready'.Ignoring
- 按照步骤安装的,但是android虚拟机启动不了
- 求助 网络视频播放。。。
- ubuntu设置jdk全局环境变量
- Listview 探讨
- 请教:为什么android签名后,放到手机上装会显示解析软件包时出现问题
另一个中是过滤颜色。