Peli, thank you so much for your thorough explanation!

On Jul 21, 3:23 am, Peli <peli0...@googlemail.com> wrote:
> What you see is exactly how it should work.
>
> > Why a fill_parent LinearLayout in another fill_parent LinearLayout
> > will occupy all the space of the outer one?
>
> Regardless of what else you put into the outer LinearLayout,
> fill_parent means to fill the parent - *not* to fill the remaining
> part of the parent, but to fill the *whole* parent. Additional widgets
> can therefore not be seen.
>
> > It is also confusing that set android:layout_weight="1" can make it
> > work. I think layout_weight should not behave like this accroding to
> > the doc.
>
> layout_weight does exactly what it should do: That is take the
> *remaining* space and divide it by all elements according to their
> weight. Since you only have 1 element left (after subtracting the size
> of the EditText), all the space will be divided by it.
>
> What else would you expect here?
>
> You can put a second LinearLayout just above the EditText and set its
> linear_weight="2". Then you will see that the first one occupies 1/3
> of the remaining screen, and the second one 2/3 of the remaining
> screen, and the EditText is also there.
>
> Peliwww.openintents.org
>
> On Jul 20, 9:00 pm, 单单 <birb...@gmail.com> wrote:
>
> > Hi All, here is a layout.
>
> > <?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="fill_parent"
> >         android:orientation="vertical">
>
> >         <LinearLayout
> >                 android:layout_width="fill_parent"
> >                 android:layout_height="fill_parent"
> >                 android:orientation="vertical"
> >                 android:background="@drawable/white"
> >                 android:layout_weight="1" >
> >         </LinearLayout>
>
> >         <EditText
> >                 android:layout_width="wrap_content"
> >                 android:layout_height="wrap_content">
> >         </EditText>
>
> > </LinearLayout>
>
> > It confused me much that the inner LinearLayout occupys all the space
> > of the outer LinearLayout and the EditText can not be seen, unless I
> > set android:layout_weight="1" to the inner LinearLayout or chenge the
> > outer LinearLayout to wrap_content.
>
> > Why a fill_parent LinearLayout in another fill_parent LinearLayout
> > will occupy all the space of the outer one?
> > It is also confusing that set android:layout_weight="1" can make it
> > work. I think layout_weight should not behave like this accroding to
> > the doc.
>
> > Any idea? Any help would be highly appriciated. (*^__^*)
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to