Search code examples
androidgridviewscrollview

ScrollView white space at bottom


I'm having an issue with ScrollView which leaves a blank space at the bottom. It is filled with few TextViews and GridViews and should fill the whole RelativeLayout parent.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:context=".showPictures">
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <TextView.../>
            <GridView.../>
        ...
        </LinearLayout>
    </ScrollView>
</RelativeLayout>

Does anybody have an idea what's wrong?


Solution

  • Make your relative layout height match parent, also use android:fillViewPort = "true" in your scroll view

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".showPictures">
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true">
    
    //...