У меня есть два вида edittext. У одной из них есть только одна строка, ее название. Но другой должен заполнить линейный выход до конца, но это не так. Я обновил код, так что это весь мой xml для этого приложения. Надеюсь, кто-то может найти, что неправильно. Часть, которую я хочу сформировать, является частью внутри LinearLayout с именем addView.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#ffffff">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/addButton"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/addbuttonstyle"
android:layout_weight="20"/>
<ImageView
android:id="@+id/titleView"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/titleview"
android:layout_weight="60"/>
<Button
android:id="@+id/orderButton"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/orderbuttonstyle"
android:layout_weight="20"/>
</LinearLayout>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/addView"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText
android:id="@+id/textBoxTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="note title"
android:singleLine="true"
/>
<EditText
android:id="@+id/textBoxContent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:hint="content"
/>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/backgroundLayout"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/background"
/>
</FrameLayout>
Поэтому я нашел, что было не так. Мне нужно было установить layout_height (из представления textBoxContent) в 0dp и layout_weight (из вида textBoxContent) в 1.
Я изменил textBoxTitle
height на wrap_content
и я вижу следующее:
Это то, на что вы надеялись? Также, если вы хотите, чтобы content
отображался в верхнем левом углу, используйте этот атрибут:
<EditText
...
android:gravity="top"
/>
Первый вид должен иметь android: layout_width = "wrap_content"