So do you think what I'm seeing is a bug with LinearLayout? It seems to be directly violating the description of how layout_gravity is supposed to work.
On Aug 31, 9:01 pm, Kostya Vasilyev <[email protected]> wrote: > As a general rule, layout_<whatever> refers to how that particular > view is positioned within its parent, while <whatever> without "layout_" > refers to the "insides" of the view. > > Even then, it's sometimes non-intuitive. > > I find myself using RelativeLayout more and more as it often can be used > to replace several nested layouts of other types. > > -- Kostya > > 31.08.2010 14:05, Zsolt Vasvari пишет: > > > > > Honestly, I haven't met a person who really understands it well. It > > always seems to be a trial and error process. Layout_gravity seems > > especially troublesome. Where you swear it should work after the > > reading the docs and thinking about it, it does not. But it sometimes > > does. Go figure. > > > On Aug 31, 1:42 am, William Ferguson<[email protected]> > > wrote: > >> Thanks! that worked. > >> Still don't understand why its not working with a LinearLayout. > > >> On Aug 31, 1:56 pm, Floaters<[email protected]> wrote: > > >>> Maybe you can try RelativeLayout... > >>> 2010/8/31 William Ferguson<[email protected]> > >>>> OK, I'm obviously missing something fundamentally simple here. > >>>> I have a LinearLayout containing 2 buttons. > >>>> I've coloured the layout background red so I can see that it has > >>>> expanded to fill its parent. > >>>> I wanted the BooButton to center horizontally within the layout and > >>>> the OtherButton to be right justified. > >>>> But both buttons are on the left of the layout. > >>>> What have I done wrong? > >>>> <LinearLayout android:id="@+id/buttonBlock" > >>>> android:orientation="horizontal" > >>>> android:background="#ff0000" > >>>> android:layout_width="fill_parent" > >>>> android:layout_height="wrap_content"> > >>>> <Button android:id="@+id/booButton" > >>>> android:text="Boo" > >>>> android:layout_gravity="center_horizontal" > >>>> android:layout_width="wrap_content" > >>>> android:layout_height="wrap_content"/> > >>>> <Button android:id="@+id/otherButton" > >>>> android:text="Other" > >>>> android:layout_gravity="right" > >>>> android:layout_width="wrap_content" > >>>> android:layout_height="wrap_content"/> > >>>> </LinearLayout> > >>>> -- > >>>> You received this message because you are subscribed to the Google > >>>> Groups "Android Developers" group. > >>>> To post to this group, send email to [email protected] > >>>> To unsubscribe from this group, send email to > >>>> [email protected]<android-developers%2bunsubs[email protected]> > >>>> For more options, visit this group at > >>>>http://groups.google.com/group/android-developers?hl=en-Hide quoted text - > >> - Show quoted text - > > -- > Kostya Vasilyev -- WiFi Manager + pretty widget > --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

