次のように、さまざまな状態で描画可能な背景を変更するボタンを作成しました。
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/btn_location_pressed" /> <!-- pressed -->
<item android:state_focused="true" android:drawable="@drawable/btn_location_pressed"/> <!-- focused -->
<item android:drawable="@drawable/btn_location"/> <!-- default -->
</selector>
ここでの問題は、ドローアブルの場合と同じようにtextColorも変更しようとしているのに、変更できないことです。私はすでにandroid:textColorとandroid:colorを試しましたが、秒が私の背景を変更している間、最初のものは機能しません。
次のコードは私のレイアウトの一部です。テキストの色に関しては、通常の状態のテキストの色でのみ機能するため、押している間は白に変更されません。
<Button android:id="@+id/location_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:background="@drawable/location"
android:textSize="15sp"
android:textColor="@color/location_color"
android:textColorHighlight="#FFFFFF"
/>
誰か手がかりがありますか?