我做了一個按鈕選擇器包含3個狀態 - 默認,重點&啓用/激活。 我的意圖是默認顯示@drawable/normal
;觸摸/按下時觸摸@drawable/focused
; @drawable/enabled
當按鈕啓用。但它不起作用&只顯示默認(正常)可繪製。按鈕選擇器drawable不會改變觸摸
繪製,華電國際/ button_selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/enabled" android:state_pressed="true"></item>
<item android:drawable="@drawable/focused" android:state_focused="true"></item>
<item android:drawable="@drawable/normal"></item>
</selector>
layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".RitualMainActivity" >
<include layout="@layout/merge_separator" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/button_selector" />
</LinearLayout>