开发者

Use selector file to get rid of orange-focus button hilite?

I took the btn_default.xml file from the android sdk under platforms/android-7/data/res/drawable-mdpi and stuck in my application's drawable directory.

Then, I took all the 9-patch images referenced in the XML file and copied those to my drawable directory also.

Next, I modified each 9-patch image having any orange in it so it was red (for testing) and saved it.

When I run my app, and focus a button with the keypad, or just touch one, I'm still getting the orange hilite color around the button. Where is that orange hilite coming from???

This is my selector file:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item 
        android:state_window_focused="false" 
        android:state_enabled="true"
        android:drawable="@drawable/btn_default_normal" />

    <item 
        android:state_window_focused="false" 
        android:state_enabled="false"
        android:drawable="@drawable/btn_default_normal_disable" /&开发者_如何学JAVAgt;

    <item 
        android:state_pressed="true" 
        android:drawable="@drawable/btn_default_pressed" />

    <item 
        android:state_focused="true" 
        android:state_enabled="true"
        android:drawable="@drawable/btn_default_selected" />

    <item 
        android:state_enabled="true"
        android:drawable="@drawable/btn_default_normal" />

    <item 
        android:state_focused="true"
        android:drawable="@drawable/btn_default_normal_disable_focused" />

    <item
         android:drawable="@drawable/btn_default_normal_disable" />

</selector>


Well, after much digging around, I found the answer below. It doesn't seem possible to set the selector color (btn_square_overlay_pressed.png) from a selector file. I had to setSelector() on my gridview object which was populating it's contents from an ImageAdapter which was getting it's images from the xml selector file.

How to change the fading orange color In ExpandableListView?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜