BottomAppBar褪色ListView

我有一个带有listview的布局,也需要添加带有浮动按钮的底部栏,但是当我将其添加到listview下方时,栏未显示,并且当我将栏放置在listview上方时,listview就像继续第二个方案,褪色。

<LinearLayout 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=".Home"
android:orientation="vertical"
android:background="#f7f8f8"> 
<LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content">
   <ListView
       android:layout_marginTop="25dp"
       android:layout_marginStart="20dp"
       android:layout_marginEnd="20dp"
       android:layout_width="match_parent"
       android:padding="4dp"
       android:scrollbars="none"
       android:id="@+id/recyclerView"
       android:divider="@null"
       android:background="#00FFFFFF"
       android:dividerHeight="10.0sp"
       android:layout_height="wrap_content"/>
  </LinearLayout>
   <androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/bottomAppBar"
        style="@style/Widget.MaterialComponents.BottomAppBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:fabCradleRoundedCornerRadius="0dp"
        app:backgroundTint="#ffffff"
        app:buttonGravity="bottom"
        app:fabAlignmentMode="center"
        app:navigationIcon="@drawable/home"
        />

 <com.google.android.material.floatingactionbutton.FloatingactionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/schedule"
        app:backgroundTint="@color/colorPrimary"
        app:fabSize="normal"
        app:layout_anchor="@id/bottomAppBar"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
  </LinearLayout>

Below ListView Above ListView

什么会导致这种问题?我很困惑,因为在其他布局上效果很好,但是在使用Listview时却遇到了问题

更新,我试图删除ListView,结果是BottomAppBar忽略了重力Without ListView。仍然没有找到解决方案。 已解决,制作了根目录布局-协调器布局

czh28690 回答:BottomAppBar褪色ListView

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3141464.html

大家都在问