Seems like your intent is a side-by-side layout for a tablet device.

I would recommend you use a top-level LinearLayout (orientation=horizontal),
and give your two relative layouts layout_width="0dp" and layout_weight="1"
(that's for a start, you can also experiment with
layout_width="wrap_content" and other weight values).

You could also change the way you align two buttons side by side: instead of
anchoring the right one, and setting layout_toLeftOf on the left one, try a
more natural sequence. Set layout_alignParentLeft on the left one, and
layout_toRightOf on the right one. This applies to all four left/right
button pairs you have in the entire layout.

-- Kostya

2011/1/23 Rutton <[email protected]>

>      Hello there,
>
> I am having a question regarding the layout of a RelativeLayout.
> In a small test I have used a layout as this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>        android:layout_width="fill_parent"
> android:layout_height="fill_parent">
>
>        <RelativeLayout android:id="@+id/right_buttons"
>                android:layout_width="wrap_content"
> android:layout_height="wrap_content"
>                android:layout_alignParentRight="true"
> android:layout_alignParentTop="true"
>                android:layout_alignParentBottom="true">
>                <Button android:id="@+id/ftopLeft"
> android:layout_width="wrap_content"
>                        android:layout_height="wrap_content"
> android:text="ftopLeft"
>                        android:layout_alignParentTop="true"
> android:layout_toLeftOf="@+id/
> ftopRight">
>                </Button>
>                <Button android:id="@+id/ftopRight"
> android:layout_width="wrap_content"
>                        android:layout_height="wrap_content"
> android:text="ftopRight"
>                        android:layout_alignParentRight="true"
> android:layout_alignParentTop="true">
>                </Button>
>                <Button android:id="@+id/fbottomLeft"
> android:layout_width="wrap_content"
>                        android:layout_height="wrap_content"
> android:text="fbottomLeft"
>                        android:layout_alignParentBottom="true"
> android:layout_toLeftOf="@
> +id/fbottomRight">
>                </Button>
>                <Button android:id="@+id/fbottomRight"
> android:layout_width="wrap_content"
>                        android:layout_height="wrap_content"
> android:text="fbottomRight"
>                        android:layout_alignParentRight="true"
>                        android:layout_alignParentBottom="true">
>                </Button>
>        </RelativeLayout>
>
>        <RelativeLayout android:layout_width="wrap_content"
>                android:layout_height="wrap_content"
> android:layout_alignParentLeft="true"
>                android:layout_alignParentBottom="true"
> android:layout_alignParentTop="true"
>                android:layout_toLeftOf="@id/right_buttons">
>                <Button android:layout_width="wrap_content"
>                        android:layout_height="wrap_content"
> android:text="stopLeft"
>                        android:layout_alignParentLeft="true"
> android:layout_alignParentTop="true">
>                </Button>
>                <Button android:layout_width="wrap_content"
>                        android:layout_height="wrap_content"
> android:text="stopRight"
>                        android:layout_alignParentRight="true"
> android:layout_alignParentTop="true">
>                </Button>
>                <Button android:layout_width="wrap_content"
>                        android:layout_height="wrap_content"
> android:text="sbottomLeft"
>                        android:layout_alignParentLeft="true"
>                        android:layout_alignParentBottom="true">
>                </Button>
>                <Button android:layout_width="wrap_content"
>                        android:layout_height="wrap_content"
> android:text="sbottomRight"
>                        android:layout_alignParentRight="true"
>                        android:layout_alignParentBottom="true">
>                </Button>
>        </RelativeLayout>
>
> </RelativeLayout>
>
> Two RelativeLayouts within a single "full-screen" RelativeLayout.
> (test only works in landscape on a large screen). I would expect, that
> the first nested RelativeLayout is as large as the four aligned
> buttons (because it has wrap_content as layout width). But in fact it
> spans the whole screen. The result is, that the second nested
> RelativeLayout, as it is aligned toLeftOf the first one,  is moved off
> the screen.
>
> If I use a layout_width with a concrete value, such as 220dp, for the
> first nested RelativeLayout  this RelativeLayout is way smaller and
> the second nested RelativeLayout is correctly assign as toLeftOf and
> is on screen.
>
> Can someone tell me, why? Or is this a bug?
>
>    Cheers,
>    Rutton.
>
> --
> 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

Reply via email to