0
我試圖創建一個ImageButton,根據它啓用與否來更改它的圖標。我創建了以下文件:ImageButton將src設置爲StateListDrawable
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icn_increase_inactive" />
<item android:state_enabled="true" android:drawable="@drawable/icn_increase_active" />
</selector>
切換啓用狀態和禁用狀態之間沒有任何更改。此外,我試圖創建我自己的ImageButton,它擴展ImageButton並嘗試和手動切換狀態,但在ImageButton中,它將繪圖作爲BitmapDrawable加載,而不是作爲StateListDrawable加載。當在圖像按鈕外部加載時,它可以像StateListDrawable一樣工作。有任何想法嗎?
您是否使用過' –
joao2fast4u
2014-11-05 16:44:09