gpt4 book ai didi

android - 底部应用栏顶部的阴影

转载 作者:太空狗 更新时间:2023-10-29 16:10:51 26 4
gpt4 key购买 nike

我正在使用新的 Bottom App Bar来自 Material 设计组件。我正在尝试在底部应用栏的顶部添加阴影,就像 Google Tasks 应用中的阴影一样,如下所示。

enter image description here

我尝试同时使用 android:elevationapp:elevation 属性。请帮忙。

最佳答案

我最终使用了这个 solution .


第一步在 drawable 文件夹中创建一个 shape_drawable.xml 文件,如下所示:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#1F000000"
android:endColor="@android:color/transparent"
android:angle="90" />
</shape>

第 2 步创建一个 View,将 shape_drawable.xml 设置为其背景,然后将 View 放置在 BottomAppBar 的正上方。

<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_above="@id/bottom_bar"
android:background="@drawable/shape_drawable"/>

关于android - 底部应用栏顶部的阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51419428/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com