带有 GridView 的 ScrollView 不滚动到底部

ScrollView with GridView not scrolling to the bottom

    <ScrollView
    android:id="@+id/verticalScrollView_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true"
    app:layout_constraintTop_toBottomOf="@id/pets_for_sale_text">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <GridView
            android:id="@+id/listing_GridViewLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:numColumns="auto_fit"
            android:padding="5dp"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">
        </GridView>
        <!--<View-->
            <!--android:layout_width="match_parent"-->
            <!--android:layout_height="400dp"-->
            <!--android:layout_below="@id/listing_GridViewLayout"-->
        <!--android:layout_marginTop="0dp"-->
        <!--android:id="@+id/simulate_bottom_margin_view" />-->
    </LinearLayout>
</ScrollView>

我尝试了很多解决方案,包括向 ScrollViewLinerLayout 添加填充,但没有任何效果。还尝试在底部添加额外的视图以创建额外的填充,也什么都不做。任何 help/suggestion 将不胜感激。

(看看第二个网格图片,看看有什么问题,第一个网格是我想要达到的结果)

在您的 GridView 布局元素中设置:

android:nestedScrollingEnabled="false"

请尝试将 Scrollview 的高度更改为 Match_parent

好吧,对我有用的解决方案是将 "app:layout_constraintBottom_toTopOf" 添加到 gridview,以便它保持在显示的工具栏的顶部。感谢您的回答。