简体   繁体   English

使底部工作表在顶部 android studio 有阴影

[英]Make bottom sheet have a shadow at the top android studio

I am having a bottom sheet and i would like the top to have a shadow because the back fragment is white and the bottom sheet is also white and is confusing我有一张bottom sheet ,我希望顶部有一个shadow ,因为后面的片段是白色的,而底片也是白色的,令人困惑

Below is the code of the bottom sheet下面是底部工作表的代码


<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>

add添加

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

to your bottomsheet viewgroup(RelativeLayout)到您的bottomsheet视图组(RelativeLayout)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM