Ripple is drawn below ImageView

2.1k Views Asked by At

I have an ImageView and a CheckBox inside a FrameLayout. Although the CheckBox is placed above the ImageView, its ripple feedback is drawn below the ImageView. Is there any way to draw the ripple on top? Tried adding elevation values but nothing changed.

example

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ImageView

    android:layout_height="285dp"
    android:layout_width="300dp"
    android:src="@drawable/rectangle"
    android:layout_gravity="center_horizontal|top" />

<CheckBox
    android:layout_gravity="center"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="New CheckBox" />

</FrameLayout>
1

There are 1 best solutions below

2
On BEST ANSWER

Seems that the ripples are drawn on top of their container's background. So I put the CheckBox in another container, set the container's background to transparent and the ripple showed up correctly.