I want a few EditTexts with buttons on their right. Right now I just have the Edittexts filling the parent with the 0dp trick. If I add the button the height of the EditText will shrink with wrap_content. If I do match_parent one EditText fills the entire screen.
RelativeLayout doesn't work because you can't make it match the parent in the same way as LinearLayout.
I thought of getting the screen height and then setting the layout height to 1/7 that (since I have 7 EditTexts). Plausible?
<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>
I only did the double LinearLayout in the first EditText.
http://i.imgur.com/t4hN6nO.jpg
See how the second one is larger than the rest to compensate and the first is smaller?