Forgot to paste the closing RelativeLayout tag. Just add this to the end of the XML:
</RelativeLayout> On Wednesday, March 21, 2012 11:28:53 AM UTC-7, rdietrick wrote: > > I don't make this stuff up. Try this one on for size: > > Take out the android:layout_alignParentRight="true" attribute from the > "child" view and you'll see that the parent_layout reverts back to it's > min_width of 280dp. But with that attribute set to true the parent_layout > expands horizontally to fill its parent. > > <?xml version="1.0" encoding="utf-8"?> > <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" > android:id="@+id/root_container" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > android:layout_gravity="center" > android:background="#FFFFFF" > android:gravity="center_horizontal" > > > <RelativeLayout > android:id="@+id/parent_layout" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:minWidth="280dp" > android:minHeight="200dp" > android:layout_centerInParent="true" > android:background="#FFFFFF" > android:padding="0dp"> > > <TextView > android:id="@+id/title" > android:layout_width="280dp" > android:layout_height="wrap_content" > android:layout_centerHorizontal="true" > android:gravity="center" > android:background="#666666" > android:text="Title" > android:textSize="23sp" > android:textStyle="bold" /> > > <TextView > android:id="@+id/child" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:layout_below="@+id/title" > android:layout_marginLeft="15dp" > android:layout_marginTop="40dp" > android:text="PROBLEM ELEMENT" > android:textSize="18sp" > android:textStyle="bold" > android:background="#666666" > android:layout_alignParentRight="true" > /> > > </RelativeLayout> > > On Tuesday, March 20, 2012 11:24:46 PM UTC-7, Zsolt Vasvari wrote: >> >> I have never noticed this and I have many-many Relative layouts. >> >> On Wednesday, March 21, 2012 10:21:59 AM UTC+8, rdietrick wrote: >>> >>> I have a RelativeLayout that encapsulates several other views. I have >>> the layout_width of the parent (RelativeLayout) set to "wrap_content." If >>> I set the layout_alignParentRight attribute of one of the child views to >>> "true," it expands the parent layout horizontally to fill the screen. Is >>> there a way around this? I believe setting layout_alignParentBottom="true" >>> does the same thing vertically, while left and top don't. >>> >>> Thanks. >>> >>> -rob >>> >> -- 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

