Hi,
I found this thread
http://groups.google.com/group/android-developers/browse_thread/thread/125dd6c435aa7cad/c19724a514558af7
which seems to be closed. I don't think it's an actual solution, it's
more of a we needed this to work now. I am having the same issue where
the centerVertical seems to center the entire layout at the center of
the screen.  Without it, the layout floats at the top of the screen
and wraps the content correctly, however all the elements are aligned
with the top of the window, I just want them to be centered vertically
within the layout.

Here is a sample of the layout I am using. Basically it's a button on
the left and a button the right with some text in the middle between
them. Ideally I would like that text in the middle of them to be
center aligned with the buttons. Am I doing something wrong? This
works fine on all other versions of Android OS other than 1.5.

-Greg

<RelativeLayout android:layout_width="fill_parent"
        xmlns:android="http://schemas.android.com/apk/res/android";
        android:layout_height="wrap_content" android:id="@+id/title_bar"
        android:minHeight="0px" android:background="@drawable/title_bar_bg">

        <Button android:layout_width="wrap_content"
                android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
                android:hint="&lt;left&gt;" android:id="@+id/left_button"
                android:layout_gravity="left|center_vertical" 
android:gravity="left|
center_vertical"
                ></Button>

        <TextView android:layout_height="wrap_content" android:id="@+id/
title"
                android:hint="&lt;Title&gt;"
                android:layout_gravity="center"
                android:layout_toRightOf="@+id/left_button"
                android:layout_toLeftOf="@+id/right_button" 
android:gravity="center"
android:layout_centerVertical="true"
android:layout_width="fill_parent"></TextView>

        <Button android:layout_height="wrap_content"
                android:layout_width="wrap_content" 
android:id="@+id/right_button"
                android:hint="&lt;right&gt;" android:layout_gravity="right|
center_vertical"
                android:layout_alignParentRight="true"></Button>


</RelativeLayout>

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