Limit of Android Layout

Asked

Viewed 625 times

1

Good morning, I made a Layout for my last project, and agr want to expand the fields, soq for this I want the layout not to end up in the corner of the screen, I want me to slide my finger and lower the screen Where would I make that change? Thanks in advance for the attention :D

1 answer

5


You need to add your layout inside a Scrollview, thus:

<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>

That way, in case the contents of your LinearLayout does not fit on the screen, Android itself will try to make the screen slidable.

Addendum:

Note that Scrollview accepts ONLY ONE direct child, that is, only one layout can have Scrollview as direct parent. In the example I posted, this Layout is the Linearlayout.

For example, you can’t 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>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.