1

My ScrollView does not scroll all the way to the bottom, I have read a few similar questions here like this and this among others. I tried adding 10dp padding bottom but it did not help. The image below shows how my problem looks

notScrolled

And the image below is how it is supposed to look (Added 150dp padding bottom)

scrolled

As you can see there is another item at the bottom. I also can't simply keep the 150 padding bottom because the number of items being displayed in the list are being fetched from a database and may vary, therefore i would need to increase/decrease the padding

Here is my XML for the fragment

    <?xml version="1.0" encoding="utf-8"?>

<android.support.percent.PercentRelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/weekDisplayed">

    <android.support.percent.PercentRelativeLayout
        app:layout_heightPercent="10%"
        android:layout_width="match_parent"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:id="@+id/header"
        android:background="@drawable/main_calendar_header_menu">

            <ImageView
                android:layout_width="35dp"
                android:layout_height="35dp"
                app:layout_marginLeftPercent="3%"
                android:layout_centerVertical="true"
                android:id="@+id/prevIcon"
                android:layout_alignParentStart="true"
                android:layout_alignParentLeft="true"
                android:background="@mipmap/arrow_left"/>

        <TextView
            android:text="Placeholder"
            android:layout_centerHorizontal="true"
            android:id="@+id/periodTextView"
            android:layout_centerInParent="true"
            android:textSize="17sp"
            android:textStyle="bold"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"/>

        <ImageView
            android:layout_width="35dp"
            android:layout_height="35dp"
            app:layout_marginRightPercent="3%"
            android:layout_centerVertical="true"
            android:id="@+id/nextIcon"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:background="@mipmap/arrow_right"/>

    </android.support.percent.PercentRelativeLayout>

        <ScrollView
            android:id="@+id/scrollView"
            android:layout_below="@+id/header"
            android:layout_centerHorizontal="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingBottom="10dp">

                <RelativeLayout
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:id="@+id/daysContainer"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"
                    android:paddingBottom="10dp">

                </RelativeLayout>


                <View
                    android:layout_width="match_parent"
                    android:layout_height="10dp"
                    android:background="@drawable/shadow_middle"
                    android:layout_below="@+id/daysContainer"
                    android:id="@+id/shadowMiddle"/>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/shadowMiddle"
                    android:id="@+id/summaryContainer"
                    android:paddingBottom="150dp">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingLeft="10dp"
                        android:paddingRight="10dp"
                        android:id="@+id/commissionSummaryContainer"
                        android:layout_alignParentTop="true">

                    </RelativeLayout>

                    <View
                        android:layout_height="10dp"
                        android:layout_width="match_parent"
                        android:id="@+id/shadowBottom"
                        android:layout_below="@+id/commissionSummaryContainer"
                        android:background="@drawable/shadow_middle"/>

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingLeft="10dp"
                        android:paddingRight="10dp"
                        android:id="@+id/absenceSummaryContainer"
                        android:layout_below="@+id/shadowBottom">

                    </RelativeLayout>

                </RelativeLayout>

            </RelativeLayout>

    </ScrollView>

</android.support.percent.PercentRelativeLayout>

The @+id/daysContainer, @+id/commissionSummaryContainer and @+id/absenceSummaryContainer are the views where its children are being fetched and created dynamically.

Community
  • 1
  • 1
Simon Andersson
  • 751
  • 1
  • 9
  • 29

1 Answers1

0

As Mehmet Kologlu said, I gave my ScrollView a fixed height of app:layout_heightPercent="80%" instead of wrap_content and that solved my problem.

Community
  • 1
  • 1
Simon Andersson
  • 751
  • 1
  • 9
  • 29