Hmm it looks like my diagrams didn't post quite right to the message
board.

Just use your imagination to picture nicely drawn boxes that borders
the text :)


On Aug 13, 12:19 pm, Boxy <[email protected]> wrote:
> First let me say that this problem is probably real easy to solve.
> But I've been looking at it all night and its got me stumped.  So to
> keep from pulling my hair out, I'll post this problem here where some
> expert can look at it for 5 seconds and figure out what I'm an
> idiot :)
>
> Here's the background info for what I am trying to do.  I have a
> ListView that displays text input from the user (similar to the
> Android notepad example).  I want to center the text inside a
> background image (text bubble).  I want the text bubble to be centered
> in view.
>
> -------------------------------------------------------------------------
>
>                                  -----------------------
>                                  |                            |
>                                  |     Hi, I'm Boxy     |
>                                  |                            |
>                                  -----------------------
>
> -------------------------------------------------------------------------
>
> This is what an ideal to look like.
>
> Here is the code I'm using.
>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:layout_width="fill_parent"
>     android:layout_height="?android:attr/listPreferredItemHeight"
>     android:padding="6dip"
>     android:gravity="center" >
>
>     <LinearLayout
>         android:orientation="vertical"
>         android:layout_width="fill_parent"
>         android:layout_weight="1"
>         android:layout_height="fill_parent"
>         android:gravity="center"
>         android:background="@drawable/textbub" >
>
>         <TextView
>             android:id="@+id/txtMessage"
>             android:layout_width="fill_parent"
>             android:layout_height="0dip"
>             android:layout_weight="1"
>             android:paddingLeft="40dip"
>             android:paddingRight="20dip"
>             android:gravity="center" />
>
>     </LinearLayout>
>
> </LinearLayout>
>
> Here is what is actually displayed by my program.
>
> -------------------------------------------------------------------------
>
>      --------------- -----------------------------------------------
>
> |
> |
>      |                                 Hi, I'm
> Boxy                          |
>
> |
> |
>      --------------------------------------------------------------
>
> -------------------------------------------------------------------------
>
> Above is what the first entry looks like.  Not what I want.
> Below is what the rest of the entries look like after the first.
> Definitely not what I want.
>
> -------------------------------------------------------------------------
>
>       ----------------------------
>       |                                  |
>       |    What happened?   |
>       |                                  |
>       ----------------------------
>
> -------------------------------------------------------------------------
>
>        ------------------------------------
>       |                                             |
>       |    Why isn't this working?     |
>       |                                             |
>       -------------------------------------
>
> -------------------------------------------------------------------------
>
>       -------------------
>       |                     |
>       |    This sux!   |
>       |                     |
>       ------------------
>
> -------------------------------------------------------------------------
>
> So what am I doing wrong?
>
> Bonus Question:
>
> A RelativeLayout is supposed to be more efficient than a LinearLayout.
> Can I use a RelativeLayout for what I'm trying to do instead of a
> LinearLayout?
> If so, how?
--~--~---------~--~----~------------~-------~--~----~
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