How to make all content fit on the screen?

Asked

Viewed 47 times

0

Hello! I am developing an App. However, I have difficulty in making all content fit on the screen. The code in question:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingStart="@dimen/margmEsq"
    android:paddingTop="@dimen/margSup"
    android:paddingEnd="@dimen/margDir"
    android:paddingBottom="@dimen/margInf"
    tools:context=".MainActivity">

    <EditText
        android:id="@+id/edtxtNome"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/hintNome"
        android:inputType="textCapWords"/>

    <DatePicker
        android:id="@+id/pickerData"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/margDir"
        android:layout_marginStart="@dimen/margEsq"
        android:layout_gravity="center_vertical"
        />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/digitContato"
            android:inputType="phone"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/digitDescricao"
            android:inputType="textShortMessage"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/digitEmail"
            android:inputType="textEmailAddress"/>

        <Button
            android:id="@+id/buttonSeguinte"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="@string/seguinte" />
    </LinearLayout>
</LinearLayout>
  • Have you tried changing your Linearlayout, the first android:layout_height="wrap_content" for android:layout_height="match_parent" ??

1 answer

1


@Yosh, to do this is very simple. just use the tool "Scrollview" that serves for the screen to be scrolling. I’ll put a basic code for it underneath.

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

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">


            Coloque o codido que tens ai em cima aqui


       </LinearLayout>
        </ScrollView>

Browser other questions tagged

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