Столбец GridLayout выходит за пределы
Я пытаюсь сделать сетку, похожую например на официальном блоге разработчиков Android.
Вот мой макет:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginRight="48dp"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:columnCount="2"
android:rowCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="end"
android:layout_row="0"
android:text="Send"
android:textColor="?android:attr/textColorPrimary"
android:textSize="24sp" />
<Spinner
android:id="@+id/send_currency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="end"
android:layout_row="1"
android:text="to"
android:textColor="?android:attr/textColorPrimary"
android:textSize="24sp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="1"
android:hint="username"
android:textColor="?android:attr/textColorPrimary"
android:textSize="24sp" />
</GridLayout>
</LinearLayout>
Мой левый столбец (статический текст, выровненный по правому краю) работает нормально. Он выравнивает текст вправо, а ширина зависит от самой широкой строки.
Тем не менее, правый столбец, похоже, выходит за пределы GridLayout.
На этом рисунке синее поле - это границы GridLayout. Вы уже можете увидеть проблему в зеленой полосе вверху. Предполагается, что правая сторона останавливается в границах GridLayout (как и левая сторона), но по какой-то причине она проходит мимо нее.
Синее поле на этом изображении является границами EditText (для него установлено значение wrap_content). Однако коробка цвета морской волны - это границы, в которых разрешено расширяться. Когда я набираю много символов в EditText, он выходит за границы GridLayout и даже за край экрана телефона!
Это ошибка в GridLayout? Или я что-то упустил?