View inside ScrollView doesn't take all place
Solution 1:
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 aScrollView
. After all, theScrollView
would become useless if its content was always as tall as itself. To work around this, you need to use the ScrollView attribute calledandroid:fillViewport
. When set to true, this attribute causes the scroll view’s child to expand to the height of theScrollView
if needed. When the child is taller than theScrollView
, the attribute has no effect.
http://www.curious-creature.org/2010/08/15/scrollviews-handy-trick/
Solution 2:
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>