tags:

views:

75

answers:

1

Hi,

I want to set a specific image when my button is not clickable. This button image is already selected according focused and pressed state thanks to this xml:

  <?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;

    <item android:clickable="false"
     android:drawable="@drawable/cmb_bouton_acces_inactive" />

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

    <item android:state_focused="false" android:state_pressed="true"
     android:drawable="@drawable/cmb_bouton_acces_hover" />

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

</selector>

But I do not know how to define a new image for the button when it is not clickable.

Any idea ?

Regards, Quentin

+1  A: 

Try android:state_enabled="false" as the qualifier. Here is a link to a thread that shows an example.

CommonsWare