I've tried several times now to use android:layout_alignCenterInParent to center a child in its parent RelativeLayout view, but it never seems to work.

What's wrong with this code, and why doesn't it center the GridView in the outer RelativeView?

<?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"
><GridView
        android:id="@+id/select_grid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:numColumns="3"
        android:columnWidth="90dp"
        android:stretchMode="none"
        android:gravity="center"
        android:verticalSpacing="10dp"
        android:horizontalSpacing="10dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp" >
</GridView>
</RelativeLayout>

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