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 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