下级同级视图后面显示的波纹

ved*_*ant 5 android

我创建了一个列表项(如图所示),其中包含ImageView(美丽的米兰达·可儿)和ImageButton带有背景的(垃圾图标)selectableItemBackgroundBorderless

在此输入图像描述

现在,当我单击垃圾桶图标时,会在垃圾箱后面创建波纹ImageView

当然,我希望波纹发生在图像前面和垃圾图标后面。

满的item.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/image_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        tools:src="@drawable/cover"
        />

    <ImageButton
        android:id="@+id/trash_image_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right|bottom"
        android:src="@drawable/translucent_trash"
        android:background="?attr/selectableItemBackgroundBorderless"
        />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

小智 1

这是同样的问题:Ripple Behind other view

您可以通过背景透明的 FrameLayout 来包装按钮。