RelativeLayout - positioning a View under a ViewGroup

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2010-04-23T03:39:30Z Indexed on 2010/04/23 3:43 UTC
Read the original article Hit count: 226

Filed under:

I have the following structure defined in an xml layout file.

<RelativeLayout android:id="@+id/mainLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<FrameLayout android:id="@+id/frame" android:layout_centerInParent="true" android:layout_width="wrap_content" android:layout_height="wrap_content" ></FrameLayout>
<Button android:id="@+id/button" android:layout_below="@id/frame" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</RelativeLayout>

The FrameLayout is positioned correctly in the center of its parent. But the Button isn't getting positioned under it. Instead it's displaying in the top left corner.

Am I doing something incorrectly or is this a bug with RelativeLayout?

© Stack Overflow or respective owner

Related posts about android