【发布时间】:2011-02-26 18:43:49
【问题描述】:
我正在为我的 ListView 使用我自己的选择器,但不使用默认选择器。你应该如何设置默认的背景drawable?使用下面的代码,我希望我的所有列表行在聚焦或按下之前都是蓝色的。
<?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="#0266e9"
android:endColor="#0484f2"
android:angle="90" />
</shape>
</item>
<item android:state_focused="true" >
<shape>
<gradient
android:startColor="#bbccff"
android:endColor="#dce4fd"
android:angle="90" />
</shape>
</item>
<item>
<shape>
<solid android:color="#FF0000FF"></solid>
</shape>
</item>
</selector>
【问题讨论】:
-
您找到解决此问题的方法了吗?我在这里遇到了完全相同的问题:stackoverflow.com/questions/4730691/…