Hi Mark,

Thanks, I really like your post.

I actually started out using LinearLayout but I ran into the same
centering problem that you ended your post on. It was my obsession
with centering "Upper" and "Lower" horizontally across the entire list
item that drove me to RelativeLayout.

I've finally achieved the layout I was looking for, but I had to use
FrameLayout to do it. See below. I'm thinking that TableLayout may
also be suitable but I haven't had time to try it out.

Spencer Riddering

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/
android"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     >
     <TextView
         android:text="Left Center"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
     />
     <LinearLayout
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
         android:layout_gravity="center"
         >
         <TextView
             android:text="Upper"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_horizontal"
             android:layout_weight="1"
         />
         <TextView
             android:text="Lower"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_horizontal"
             android:layout_weight="1"
         />
     </LinearLayout>
</FrameLayout>



On Sep 2, 10:20 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> Spencer Riddering wrote:
> > You seem to have missed the problem entirely. Please compile next
> > time.
>
> I did you one better. I wrote up a whole blog post on my diagnostic steps:
>
> http://androidguys.com/2008/09/02/diagnosing-layout-problems/
>
> The upshot is that I fixed the problem with the stacked Upper/Lower
> TextViews, but I can't figure out what's up with the Left Center one. As
> I wrote in the post, it could be a bug, or it could be that
> RelativeLayout is just plain unintuitive to me.
>
> I transcoded the layout into one using pure LinearLayouts at the end,
> which gets you something that is *almost* what you need.
>
> Sorry that I was unable to completely resolve your issue.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 1.1 Published!

http://spencer.riddering.net
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to