How to set an image for an inactive button
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">
<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开发者_Go百科: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
Try android:state_enabled="false"
as the qualifier. Here is a link to a thread that shows an example.
精彩评论