gpt4 book ai didi

android - 无法在 BottomAppBar 中获得提升

转载 作者:行者123 更新时间:2023-11-29 23:49:47 25 4
gpt4 key购买 nike

如何获取 BottomAppBar 的高度。我认为默认情况下它的高度为 8dp,但我没有得到任何高度。这是我的代码。

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
style="@style/Widget.MaterialComponents.BottomAppBar" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@id/bottom_bar"
android:src="@android:drawable/ic_input_add"
android:tint="@color/colorPrimary"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

最佳答案

部分问题在于照明系统在 Android 上的工作方式。顶部有一个光源,中间有一个光源。这意味着阴影通常在 View 顶部不可见。

我们有一个错误来伪造 BottomAppBar 的阴影,但它并不像 BottomNavigation 那样微不足道,因为 fab 可以移动和改变形状,所以阴影也应该改变。

关于android - 无法在 BottomAppBar 中获得提升,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51008277/

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