I have a dynamic list view:
<ListView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fastScrollEnabled="true"
android:choiceMode="singleChoice"
android:dividerHeight="1dp"
android:divider="#1f000000"
android:background="@android:color/background_light"
android:drawSelectorOnTop="true"/>
With cell:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/list_ripple">
With ripple:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/list_selected" android:state_activated="true"/>
</selector>
This works perfectly.
My problem is on another list that I am creating. Its a static list so I am just defining the list in xml using TableLayout and TableRow. Is there a way that I can get the same 'selected' state to show. And also the ripple to show?
<TableLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="0">
<TableRow android:id="@+id/about_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingLeft="16dp"
android:paddingBottom="20dp"
android:clickable="true"
android:background="@drawable/list_ripple">
I tried to put the ripple on the background element but that didn't work. Again best case would be to get the grey selected state showing that the table row is selected and the ripple if possible.