2012-05-12 5 views
1

У меня есть два вида edittext. У одной из них есть только одна строка, ее название. Но другой должен заполнить линейный выход до конца, но это не так. Я обновил код, так что это весь мой xml для этого приложения. Надеюсь, кто-то найдет, что случилось. Часть, которую я хочу сформировать, является частью внутри LinearLayout с именем addView.Как сделать вид edittext заполнить родительский элемент в android

<?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> 

ответ

1

Так я нашел то, что было неправильно. Мне нужно было установить layout_height (из вида textBoxContent) в 0dp и layout_weight (вида textBoxContent) на 1.

1

Я изменил высоту textBoxTitle «s к wrap_content и я вижу это:

Screen Shot

Это то, что вы надеетесь? Кроме того, если вы хотите content появляться в использовании верхнего левого угла этого атрибута:

<EditText 
    ... 
    android:gravity="top" 
    /> 
+0

Это не сработало. Я обновил свой код, так что теперь вы можете увидеть весь мой xml. LinearLayout tha находится внутри FramLayout и поверх слайдов addView LinearLayout слева, когда я нажимаю кнопку. Макет addView должен быть формой добавления примечаний. – a13ks

+0

Никогда не находил ответа – a13ks

0

Первый вид должен иметь андроида: layout_width = «wrap_content»

Смежные вопросы