【发布时间】:2011-10-13 15:06:45
【问题描述】:
我在管理按钮的 Android 状态列表时遇到了一些麻烦。我为不同的状态指定了一些 Shape drwable 项目,但我还需要根据当前状态更改 textColor。
我的实际状态列表xml是:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<gradient
android:startColor="@color/white"
android:endColor="@color/light_gray"
android:angle="270" />
<stroke
android:width="3dp"
android:color="@color/classic_red1" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:startColor="@color/classic_red1"
android:endColor="@color/classic_red2"
android:angle="270" />
<stroke
android:width="2dp"
android:color="@color/white" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>
我还需要根据这两种状态更改 textColor。 提前致谢。
【问题讨论】:
标签: android drawable shape textcolor