Boxy wrote:
> 
> It looks like underestimated the difficulty of this question.
> 
> I tried to post a much simpler version of the question in the beginner
> group but its been hours and it still has not showed up.  I think they
> have a problem with new topics over there.
> 
> I'll post the question here.  I apologize for the spam :(
> 
> --------------------------------------------------------------
> 
> I want to center a TextView inside of a layout.  I've been playing
> with the XML code below and can't get it to work?
> Please help!
> 
> 
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>       android:orientation="horizontal"
>       android:gravity="center"
>       android:layout_width="fill_parent"
>       android:layout_height="fill_parent" >
> 
>       <TextView
>           android:id="@+id/txtMessage"
>           android:layout_width="fill_parent"
>           android:layout_height="fill_parent"
>           android:gravity="center" />
> 
> </LinearLayout>

Step #1: Use RelativeLayout.

Step #2: Give the TextView the android:layout_centerInParent="true"
attribute.

Step #3: Have a beer. Possibly preceded by "root" or "birch", if that's
your preference. ;-)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in Germany, 18-22 January 2010: http://bignerdranch.com

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