You are talking about @+id/MenuBarLayout right? Did you set its width to FILL_PARENT when you get the screen width? If you did this, it is totally right that your code returns the screen width, because its grand parent's width is FILL_PARENT. In this case, i think you should fix MenuBarLayout's width.
On 9 jan, 01:57, Moto <[email protected]> wrote: > Also let me ask you this: > I'm trying to get the total length of my LinearLayout which contains > few buttons all positioned horizontally roughly 600px. Now when I try > to get the width of that layout it returns the width of the what is > only shown, essentially the screen width... > > So I tried setting wrap_content for the width on but it doesn't work. > But when I set 600px it works fine... > > Any ideas? > > here is my XML if needed: > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:orientation="vertical" > android:layout_height="fill_parent" > android:layout_width="fill_parent"> > > <LinearLayout > android:id="@+id/MenuBarHolder" > android:layout_height="wrap_content" > android:layout_width="fill_parent"> > <LinearLayout android:id="@+id/MenuBarLayout" > android:layout_height="wrap_content" > android:layout_marginBottom="0px" > android:layout_width="wrap_content" android:layout_weight="1"> > > <Button android:id="@+id/btn1" > android:text="1" > android:layout_width="80px" > android:layout_height="50px"> > </Button> > <Button android:id="@+id/btn2" > android:text="2" > android:layout_width="80px" > android:layout_height="50px"> > </Button> > <Button android:id="@+id/btn3" > android:text="3" > android:layout_width="80px" > android:layout_height="50px"> > </Button> > <Button android:id="@+id/btn4" > android:text="4" > android:layout_width="80px" > android:textSize="12px" > android:layout_height="50px"> > </Button> > <Button android:id="@+id/btn5" > android:text="5" > android:layout_width="80px" > android:layout_height="50px"> > </Button> > <Button android:id="@+id/btn6" > android:text="6" > android:layout_width="80px" > android:layout_height="50px"> > </Button> > </LinearLayout> > </LinearLayout> > </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] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

