I guess this is because of the LinearLayout's android:layout_width="fill_parent". If width is fill_parent, it can't be horizontally centered. You can see that if you give background color to the LinearLayout. Try android:layout_width="wrap_content".
Or change LinearLayout's android:layout_gravity="center_horizontal" to android:gravity="center_horizontal". (I'm not sure of this one.) On Jan 15, 9:38 pm, Sunny Aujla <[email protected]> wrote: > What happens when the orientation changes? It looks fine to me, should stay > center aligned. > > On Fri, Jan 15, 2010 at 10:33 AM, Kumar Bibek <[email protected]> wrote: > > This is ok. Doesn't this work?? > > > Kumar Bibek > > > On Jan 15, 2:19 pm, Jags <[email protected]> wrote: > > > i have this layout > > > > <LinearLayout android:id="@+id/llcmd" > > > android:orientation="horizontal" > > > android:layout_height="wrap_content" > > > android:layout_width="fill_parent" > > > android:layout_gravity="center_horizontal"> > > > <Button android:layout_height="wrap_content" > > android:id="@+id/ > > > viewEvtsDone" > > > android:layout_width="wrap_content" > > android:text="Delete"></Button> > > > <Button android:layout_height="wrap_content" > > android:id="@+id/ > > > viewEvtsCancel" > > > android:layout_width="wrap_content" > > android:text="Cancel"></Button> > > > </LinearLayout> > > > > I want these 2 buttons always appear centr aligned in the > > > linearlayout. I dont want to use hard coded values (as it is upsetting > > > the positions when orientation changes) > > > > How can i make it possible ? or is it not possible ? > > > > regards > > > -- > > 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%[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en
-- 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

