让底部的表有一个阴影在顶部的android工作室



我有一个bottom sheet,我希望顶部有shadow,因为背面碎片是白色的,底部薄片也是白色的,这会混淆

下面是底部页面的代码


<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_hideable="true"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<RelativeLayout
android:id="@+id/bottomsheet"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Bottom Sheet Text"
android:textSize="30sp"/>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>

添加

android:elevation="15dp"
android:outlineProvider="bounds"

到您的bottomsheet视图组(RelativeLayout(

最新更新