セレクター用に次のコードがあります。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Button Focused-->
<item android:state_focused="true"
android:state_pressed="false"
android:drawable="@drawable/gradient_background"
/>
<!-- Button Focused Pressed-->
<item android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/gradient_background"
/>
<!-- Button Pressed-->
<item android:state_focused="false"
android:state_pressed="true"
android:drawable="@android:drawable/ic_search_category_default"
/>
<!-- Button Default Image-->
<item android:drawable="@drawable/gradient_background"/>
</selector>
そして、このセレクターを使用するアクティビティには、次のものがあります。
<ListView
android:id="@+id/contactsView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/searchButton"
android:divider="@color/DarkGoldenrod"
android:dividerHeight="0.1dp"
android:listSelector="@drawable/list_selector"
android:drawSelectorOnTop="true" />
これは、リストビュー項目をクリックして押したままにするとどのように見えるかの例です...
私の質問は: とにかくその写真を小さくして右に揃えることはできますか?
ありがとうございました。