Учитывая горизонтальный LinearLayout в Android, я бы хотел создать:
(1) текстовое поле, которое заполняет почти ширину экрана, за исключением выделения достаточно места для...
(2) кнопка справа
Итак, я создаю EditText и Button, и они оба очень маленькие.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText android:text=""
android:id="@+id/Text01"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
</EditText>
<Button android:text="+"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right">
</Button>
</LinearLayout>
Я не могу установить EditText для android: layout_width = "fill_parent", иначе он стирает кнопку. Итак, как сделать EditText как можно больше?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText android:text=""
android:id="@+id/Text01"
android:layout_width ="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
</EditText>
<Button android:text="+"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right">
</Button>
</LinearLayout>