开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜