首页 > 解决方案 > 带有 GridView 的 ScrollView 不滚动到底部

问题描述

    <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什么都不做。还尝试在底部添加额外的视图以创建额外的填充,也没有任何作用。任何帮助/建议将不胜感激。

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

标签: androidgridviewscrollview

解决方案


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


推荐阅读