I've got a list item in a recycle view and I want to get the ripple effect all over the element - currently my GIF is overlapping the ripple. I don't know how to fix this, already tried a lot of ways after researching, but nothing worked.
Here is the specific XML file on which basis I build each list item.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/selector"
android:clickable="false">
<pl.droidsonroids.gif.GifTextView
android:layout_width="84dp"
android:layout_height="84dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingRight="1dp"
android:paddingLeft="1dp"
android:background="@drawable/a_present_for_you"
/>
<TextView
android:id="@+id/textView"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/black"
android:textSize="16sp"
android:gravity="center_vertical"
android:drawableRight="@drawable/ic_lock_open_blue_24dp"
android:drawablePadding="16dp">
</TextView>
</LinearLayout>
Any ideas?
How about using FrameLayout
? Wrap those two elements with FrameLayout
instead of LinearLayout
, and set android:foreground
of this layout with your custom selector.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:foreground="@drawable/selector">
<pl.droidsonroids.gif.GifTextView
android:layout_width="84dp"
android:layout_height="84dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingRight="1dp"
android:paddingLeft="1dp"
android:background="@drawable/a_present_for_you"
/>
<TextView
android:id="@+id/textView"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/black"
android:textSize="16sp"
android:gravity="center_vertical"
android:drawableRight="@drawable/ic_lock_open_blue_24dp"
android:drawablePadding="16dp">
</TextView>
</FrameLayout>