(Android) ScrollView won't scroll to the very end of my LinearLayout

So, I have a ScrollView with a LinearLayout inside it. It seems like when I try to scroll down to the bottom of my line out, the bottom envelope ~ 5 goes down (i.e. the bottom border) I think this could have something to do with my 5dip linear span?

Here's activity_create_account.xml :

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:background="@drawable/grey" android:orientation="vertical" android:padding="0dp" tools:context=".Login" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="100" android:orientation="vertical"> <!-- BEGIN HEADER --> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:background="@drawable/titlebar" android:orientation="horizontal" android:padding="8dip" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:padding="0dp" android:text="create account" android:textColor="#FFFFFF" android:textSize="32sp" android:textStyle="bold" android:typeface="sans" /> </LinearLayout> <!-- END HEADER --> <!-- BEGIN BODY --> <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="top" android:orientation="vertical"> <LinearLayout android:id="@+id/innerLinearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="10dip" android:background="@drawable/rounded_white" android:orientation="vertical" android:padding="5dip" > <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textEmailAddress" android:ems="10" android:id="@+id/etCreateEmail" android:hint="Email" android:layout_weight="1" android:paddingTop="8dip" android:paddingBottom="8dip" android:paddingRight="8dip" android:paddingLeft="8dip" android:layout_marginBottom="4dip" android:layout_marginTop="5dip"/> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textEmailAddress" android:ems="10" android:id="@+id/etCreateEmail" android:hint="Email" android:layout_weight="1" android:paddingTop="8dip" android:paddingBottom="8dip" android:paddingRight="8dip" android:paddingLeft="8dip" android:layout_marginBottom="4dip" android:layout_marginTop="5dip"/> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textEmailAddress" android:ems="10" android:id="@+id/etCreateEmail" android:hint="Email" android:layout_weight="1" android:paddingTop="8dip" android:paddingBottom="8dip" android:paddingRight="8dip" android:paddingLeft="8dip" android:layout_marginBottom="4dip" android:layout_marginTop="5dip"/> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textEmailAddress" android:ems="10" android:id="@+id/etCreateEmail" android:hint="Email" android:layout_weight="1" android:paddingTop="8dip" android:paddingBottom="8dip" android:paddingRight="8dip" android:paddingLeft="8dip" android:layout_marginBottom="4dip" android:layout_marginTop="5dip"/> <EditText android:id="@+id/etChooseUsername" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="4dip" android:layout_weight="1" android:ems="10" android:hint="Choose a username" android:inputType="text" android:paddingBottom="8dip" android:paddingLeft="8dip" android:paddingRight="8dip" android:paddingTop="8dip" /> <EditText android:id="@+id/etChoosePassword" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="4dip" android:layout_weight="1" android:ems="10" android:hint="Choose a password" android:inputType="textPassword" android:paddingBottom="8dip" android:paddingLeft="8dip" android:paddingRight="8dip" android:paddingTop="8dip" /> <EditText android:id="@+id/etRetypePassword" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="4dip" android:layout_weight="1" android:ems="10" android:hint="Re-type password" android:inputType="textPassword" android:paddingBottom="8dip" android:paddingLeft="8dip" android:paddingRight="8dip" android:paddingTop="8dip" /> <Button android:id="@+id/bCreateAccountConfirm" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_weight="1" android:background="@drawable/button_selector" android:padding="0dip" android:text="Create Account" android:textColor="#ffffff" android:textStyle="bold" android:typeface="sans" /> </LinearLayout> </ScrollView> <!-- END BODY --> 

This is what it looks like when I try to scroll all the way down (there should be a thin section of white under the button, and then a thin section of the gray box) enter image description here

+6
source share
3 answers

In your ScrollView add padding_bottom to 10dp. It will work.

The rest of the image below the horizontal can be overlaid over this horizontal view. In this case

  • Add id to HorizontalView id="@+id/horizontalView"
  • Add below="@+id/horizontalView" in the view below the horizontal view.
+8
source

I understand that this question is a little old, but for the sake of those who find it through Google, I will try to shed some light.

It seems that the common ScrollView object does not work very well when used inside the layout with other siblings. Thus, Google created NestedScrollView . From the documentation,

NestedScrollView is similar to ScrollView, but it supports both parent and child parent scroll actions on both new and older versions of Android.

I had a similar problem with asking this question, and using NestedScrollView eliminates the clipping at the bottom of my original ScrollView.

+7
source

You can install marginBottom on your scrollview

 <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="top" android:layout_marginBottom="10dp" android:orientation="vertical"> 
+3
source

Source: https://habr.com/ru/post/948201/


All Articles