I have my listview, with a text and a ImageButton near to it, should be on the right side in the future. I want to see a ripple effect when i touch on the text or white field. How can i do this?
At the moment, theres only a ripple effect when i touch the image button.
Thats my code for list_item, where i set up the layout for a row:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text"
android:elevation="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15dp"
android:textColor="@android:color/black"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:layout_centerVertical="true"
android:layout_marginTop="40dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
/>
<ImageButton
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:src="@drawable/ic_delete_black_24dp"
android:tint="#F44336"
android:backgroundTint="@color/background"
/>
</RelativeLayout>
I found out, that i have to use a LinearLayout, but i dont know, how i have to use it correctly. My ListView looks like this:
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="#E0E0E0"
android:dividerHeight="1dp"
android:drawSelectorOnTop="true"
>
</ListView>
Here's a screenshot how it looks currently:
Any suggestions to fix? ^^ Thanks in advance
EDIT: I forgot to say, that the OnItemClickListerner from listview, doesnt work anymore, when i have defined the imagebutton