Android Layout Limit

1

Good morning, I made a Layout for my last project, and agr want to expand the fields, so I want the layout not to finish in the corner of the screen, I want to slide my finger and lower the screen Where would I make that change ?? Thank you in advance for your attention: D

    
asked by anonymous 04.11.2015 / 19:32

1 answer

5

You need to add your layout inside a ScrollView , like this:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >
        <!-- Todo o restante do seu conteúdo -->
    </LinearLayout>
</ScrollView>

In this way, if the content of your LinearLayout does not fit on the screen, Android itself will try to make the screen slide.

Addendum:

Note that ScrollView accepts JUST ONE child directly, that is, only one layout can have ScrollView as direct parent. In the example I posted, this Layout is LinearLayout.

For example, you can not do something like this in ScrollView:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            >
            <!-- Todo o restante do seu conteúdo -->
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            >
        </LinearLayout>
    </ScrollView>
    
04.11.2015 / 19:41