0

The ripple effect on on iv_button ImageView works fine untill I set background on wrapper ImageView. How to fix this?

Any help would be greatly appreciated.

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

    <ImageView
        android:id="@+id/wrapper"
        android:background="@color/green"  //the ripple effect works without this line
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <ImageView
        android:id="@+id/iv_button"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerInParent="true"
        android:background="?selectableItemBackgroundBorderless"
        android:clickable="true"
        android:src="@android:drawable/ic_delete" />

</RelativeLayout>
Hai Hack
  • 948
  • 13
  • 24

1 Answers1

0

If you set a background in that xml you will lose the ripple effect. If you want to keep it, you should set it in an style and then give that style to your button.

RDO
  • 425
  • 4
  • 6