나는 기본적으로 포커스가있는 &이 활성화/활성화 된 3 가지 상태를 포함하는 버튼 선택기를 만들었습니다. 기본적으로 내 의도 ID는 @drawable/normal
입니다. 터치/누를 때 @drawable/focused
; 버튼이 활성화 된 경우 @drawable/enabled
하지만 작동하지 않습니다. &은 기본 (일반) 드로어 블만 표시합니다. 기본적으로 참조하십시오 대신 imageview.Imageview의버튼 선택기 드로어가 터치로 변경되지 않음
당김-hdpi에/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>