开发者

Android - ListView list selector doesn't use default

I'm using my own selector for my ListView, but the default is not used. How are you supposed to set the d开发者_JS百科efault background drawable? With the below code I'd expect all of my list rows to be blue until focused or pressed.

<?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>


Could be that the default (the blue) is not visible: http://developer.android.com/reference/android/graphics/drawable/StateListDrawable.html#attr_android:visible

According to the document the visibility is initially false.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜