这是布局文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="172dp"
android:orientation="vertical"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/drawerBackgroundImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/drawer_background"/>
[...]
<ImageButton
android:id="@+id/drawerLogoutButton"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignBottom="@id/drawerEmailTextView"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
style="@style/FlatButtonStyle"
android:scaleType="centerInside"
android:src="@drawable/ic_logout_white_24dp"/>
</RelativeLayout>
(这里有一堆其他的视图,但它们与此无关)
我正在将一个 ImageView
用作 RelativeLayout
的背景,因为我需要为图像设置特定的 scaleType
,所以我不能使用基本的 android:background
属性。
涟漪效果被隐藏了,因为它没有蒙版图层(我希望它能延伸到按钮的边界之外),因此使用 ImageButton
的父视图来显示。如果我移除 ImageView
,则效果完全可见。
有没有办法使涟漪效果在有问题的 ImageView
上方显示?