In touch mode, there is no selected or focused state.
However, you can have a checked state (even without a check box) and use it to change properties when "selected". In your java code, where you set up displaying your list, add this line after the list is defined:
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
Then in your list of XML states, change this:
android:state_selected="true"
:
android:state_activated="true"
So now you should have:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true"
android:drawable="@drawable/selected_item"/>
<item android:drawable="@android:color/transparent" />
</selector>
, , :
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txt_category_row"
android:gravity="center"
android:layout_width="match_parent"
android:textColor="@color/BLACK"
android:layout_height="55dp"
android:padding="10dp"
android:text="@string/hello"
android:layout_marginTop="5dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:background="@drawable/item_selector" />
XML- , "item_selector". .