Макет не идет ко дну! Это на стороне - PullRequest
0 голосов
/ 10 февраля 2020

Когда я создаю новый макет, он появляется в правой части экрана. Я хочу, чтобы это было внизу, ниже моего линейного расположения. Пример на картинке.

LayoutPicture

Ответы [ 2 ]

0 голосов
/ 11 февраля 2020

Хотите ли вы добиться результата, подобного следующему GIF? enter image description here

, если это так, вы можете добавить android:gravity="bottom" снаружи LinearLayout, вот мой макет xml (Если вы хотите макет внизу по центру, Вы можете использовать android:gravity="bottom|center").

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"   
android:gravity="bottom"
>

<LinearLayout
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:orientation="vertical"


    >
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="First Name"
/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="Last Name"
/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="UserName"
/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="Password"
/>
    <LinearLayout
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <CheckBox
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Show Password"
            android:textColor="@android:color/black"            
        />
    </LinearLayout>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="Email"
/>
</LinearLayout>

обновление

Хотите ли вы добиться результата, подобного следующему макету ??

enter image description here

Если это так, вот код.

android:layout_width="match_parent"
android:layout_height="match_parent"

>

    >
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="First Name"
/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="Last Name"
/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="UserName"
/>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="Password"
/>
    <LinearLayout
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <CheckBox
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Show Password"
            android:textColor="@android:color/black"            
        />
    </LinearLayout>
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="Email"
/>
</LinearLayout>

0 голосов
/ 10 февраля 2020

Убедитесь, что ориентация родительского макета установлена ​​вертикально. По умолчанию он горизонтальный.

<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="match_parent"
    android:orientation="vertical">
<!-- your inner layouts here -->
</LinearLayout>

...