Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add space below scroll view

I have wrapped an activity in an scroll view like following.

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    >

    <include layout="@layout/content_form" />

</ScrollView>

I have around 15 fields in the content_form layout, the issues is that the last item in content_form layout is attached with bottom.

I need to add a margin below the scroll view, i have tried giving margin to scrollviewand the last item of content_form field, but nothing is working.

I need to know how to add margin at the bottom of page when using scroll view.

like image 638
dev90 Avatar asked Jun 25 '18 16:06

dev90


2 Answers

If you want the scrolling margin to be within the content, it would be best to add it to content_form. You should be able to accomplish this by either adding paddingBottom to your parent container in that layout, or layout_marginBottom on your last view aligned to the parent bottom.

like image 84
Bryan Dormaier Avatar answered Sep 28 '22 15:09

Bryan Dormaier


This make padding under the last item in scroll view. may be good for you

 <androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:paddingBottom="80dp"
    android:clipToPadding="false"
    android:layout_height="match_parent">
like image 22
Maysam R Avatar answered Sep 28 '22 16:09

Maysam R