Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View inside ScrollView doesn't take all place

People also ask

How many views can you use within a ScrollView?

Only one view can be included in a ScrollView .

What is fillViewport in ScrollView?

fillViewport allows scrollView to extend it's height equals to the full height of device screen's height in the cases when the child of scroll view has less height.

What is the use of ScrollView in Android Studio?

A view group that allows the view hierarchy placed within it to be scrolled. Scroll view may have only one direct child placed within it. To add multiple views within the scroll view, make the direct child you add a view group, for example LinearLayout , and place additional views within that LinearLayout.


Try adding android:fillViewport="true"to your ScrollView

remember that android:layout_height=”fill_parent” means “set the height to the height of the parent.” This is obviously not what you want when using a ScrollView. After all, the ScrollView would become useless if its content was always as tall as itself. To work around this, you need to use the ScrollView attribute called android:fillViewport. When set to true, this attribute causes the scroll view’s child to expand to the height of the ScrollView if needed. When the child is taller than the ScrollView, the attribute has no effect.

http://www.curious-creature.org/2010/08/15/scrollviews-handy-trick/


Just add android:fillViewport="true" in yout xml layout in Scrollview

<ScrollView android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:background="@color/green"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:fitsSystemWindows="true"
    android:fillViewport="true"
    >

<!--define views here-->


</ScrollView>