1
ImageButtonの多くの例がホバー上にありますが、画像が変更されています。私はちょうど背景色を変更したい。プレス上でImageButtonのバックグラウンドカラーを変更する
これは私の選択である -
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="#4B88F7"/>
<item android:state_pressed="false" android:color="#121212"/>
そして、私のImageButton -
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@color/actionbar_btn"
android:src="@drawable/ic_remove" />
を参照してください。タグは描画可能な属性または子タグを必要とします。 – reza
@reza、私は私の投稿を編集しました。色は 'btn_pressed'と' btn_released'を作成する必要があります。 – Kairat
ありがとうございました。 – reza