我使用這種方法,但它不起作用。 在繪製我創建selector.xml更改背景圖片textView按下時
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="false"
android:drawable="@drawable/reponseclicked">
</item>
<item
android:drawable="@drawable/repons">
</item>
</selector>
,這我的TextView
<TextView
android:layout_width="160dp"
android:layout_height="wrap_content"
android:id="@+id/imageView8"
android:text="text"
android:gravity="center"
android:layout_above="@+id/imageView5"
android:background="@drawable/selector"/>
請問您能否提供「不能工作」的解釋?直到那時這個問題不適合SO,因爲它沒有MCVE。 –