When the Android ScrollView is not full of a screen, it fills the screen by default

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/bg_color"
        android:orientation="vertical">
            
        ....一大堆控件....

    </LinearLayout>
</androidx.core.widget.NestedScrollView>

Although the above is set to fill the screen, the effect of running it is not.

Add fillViewport property

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/bg_color"
        android:orientation="vertical">
            
        ....一大堆控件....

    </LinearLayout>
</androidx.core.widget.NestedScrollView>

NestedScrollView and ScrollView are the same!

Guess you like

Origin blog.csdn.net/fromVillageCoolBoy/article/details/131719625