0

我有这样的布局结构:

<androidx.coordinatorlayout.widget.CoordinatorLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <!-- other layout content goes here -->

    </androidx.core.widget.NestedScrollView>

    <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/bottomBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:hideOnScroll="true"
        app:menu="@menu/menu_continue" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

NestedScrollView 填满整个屏幕。如果发生滚动内容大约是屏幕的高度(但不超过那个高度),用户会看到位于 BottomAppBar 下方的不可滚动内容(因为从 NestedScrollView 的角度来看,不需要滚动)。

现在我可以通过在滚动视图中添加底部填充或边距来轻松解决这个问题,但对我来说这是一个 hack。有没有足够干净的解决方案来解决这个问题?

4

0 回答 0