アプリにがImageButton
あり、ボタンがのときに画像の色合いを変更する必要がありますpressed/focused
。次のようなXMLファイルから取得するImageButton
セットがあります。src
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- pressed -->
<item
android:state_pressed="true"
android:tint="@color/black"
android:drawable="@drawable/search"
/>
<!-- focused -->
<item
android:state_focused="true"
android:tint="@color/black"
android:drawable="@drawable/search"
/>
<!-- default -->
<item
android:tint="@null"
android:drawable="@drawable/search"
/>
</selector>
ImageButton
ただし、を押したりフォーカスしたりしても色合いは適用されません。画像は通常どおり表示されます。黒は#000000
いつものように定義されています。何か案は?