Android «layout_alignParentBottom» в относительном макете

Итак, у меня такой макет:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/layout"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="#FFFF00"
                android:minHeight="100dp"
                android:layout_gravity="bottom"
        >
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:textColor="#000000"
            android:background="#FF0000"
            android:text="Hello World"
            />

    <Button
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_alignParentRight="true"
            android:text="button"/>
</RelativeLayout>

и вот как это выглядит:

enter image description here

но если я добавлю android:layout_alignParentBottom="true"к кнопке вот как это выглядит:

enter image description here

  1. Кто-нибудь может объяснить мне это поведение?
  2. Как поместить мою кнопку внизу, не изменяя размер желтого макета и не добавляя тысячи макетов для обходных путей?
10
задан Onik 28 March 2019 в 22:43
поделиться