Я хочу несколько EditTexts с кнопками справа. Прямо сейчас у меня только что Edittexts заполняет родителя трюком 0dp. Если я добавлю кнопку, высота EditText будет уменьшаться с помощью wrap_content. Если я делаю match_parent, один EditText заполняет весь экран.Horizonal LinearLayouts в вертикальном LinearLayout
RelativeLayout не работает, потому что вы не можете заставить его соответствовать родительскому объекту так же, как LinearLayout.
Я думал о том, чтобы получить высоту экрана, а затем установил высоту макета на 1/7 (поскольку у меня есть 7 EditTexts). Правдоподобно?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText android:id="@+id/box_0"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/edit_task"
android:saveEnabled="true"
android:inputType="textCapSentences"
android:maxLength="32"
android:padding="10dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send"
android:layout_gravity="end"/>
<!--red-->
</LinearLayout>
<EditText android:id="@+id/box_1"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:saveEnabled="true"
android:inputType="textCapSentences"
android:maxLength="32"
android:padding="10dp"/>
<EditText android:id="@+id/box_2"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:saveEnabled="true"
android:inputType="textCapSentences"
android:maxLength="32"
android:padding="10dp"/>
<EditText android:id="@+id/box_3"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:saveEnabled="true"
android:inputType="textCapSentences"
android:maxLength="32"
android:padding="10dp"/>
<EditText android:id="@+id/box_4"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:saveEnabled="true"
android:inputType="textCapSentences"
android:maxLength="32"
android:padding="10dp"/>
<EditText android:id="@+id/box_5"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:saveEnabled="true"
android:inputType="textCapSentences"
android:maxLength="32"
android:padding="10dp"/>
<EditText android:id="@+id/box_6"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:saveEnabled="true"
android:inputType="textCapSentences"
android:maxLength="32"
android:padding="10dp"/>
</LinearLayout>
Я только сделал двойной LinearLayout в первом EditText.
http://i.imgur.com/t4hN6nO.jpg
Посмотрите, как второй больше, чем остальные, чтобы компенсировать и первый меньше?
Какой тип макета вы хотите? –