mercredi 6 mai 2015

ImageButton color selector works only for open, not for close

I have the ImageButton that opens/closes my menu. I set color-states parameters for its background, like this:

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://ift.tt/nIICcg">
        <item android:state_pressed="true" android:drawable="@android:color/black"/>
        <item android:state_focused="true" android:drawable="@android:color/black"/>
        <item android:drawable="@android:color/transparent" />
    </selector>

When I press on the ImageButton to open the menu, its background color changes to black - OK. Then I press on the ImageButton again to close the menu and nothing happens, ImageButton background color doesn't change to black.

This only happens when I press the ImageButton to close the menu.

Why?

Aucun commentaire:

Enregistrer un commentaire