Friday, December 10, 2010

[android-developers] Re: Combining an image

That doesn't seem to help any (tried every combination I could think
of)

I was able to get it to align by using a RelativeLayout inside of each
table row, BUT the entire combined image is shifted to the left when I
do that and I cannot get it to re-center.

What I did then was like this:

<TableLayout
android:id="@+id/TableLayout01"
android:stretchColumns="*"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<TableRow
android:id="@+id/Row01"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical|
center_horizontal">

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<ImageView
android:id="@+id/ImageUpperLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|
center_horizontal"
android:src="@drawable/upperleft"></ImageView>
<ImageView
android:id="@+id/ImageUpperRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|
center_horizontal"
android:src="@drawable/upperright"></ImageView>

</RelativeLayout>

</TableRow>
<TableRow
android:id="@+id/Row02"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical|
center_horizontal">

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<ImageView
android:id="@+id/ImageLowerLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|
center_horizontal"
android:src="@drawable/lowerleft"></ImageView>
<ImageView
android:id="@+id/ImageLowerRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|
center_horizontal"
android:src="@drawable/lowerright"></ImageView>

</RelativeLayout>

</TableRow>
</TableLayout>


So how can I get this concoction to center?


RANT: To me this is the hardest part of working with Android.
Everything else is fairly straight forward in good old Java, but this
layout stuff, IMHO, is not very intuitive to say it in the kindest way
I know how.

On Dec 10, 2:53 pm, TreKing <treking...@gmail.com> wrote:
> On Fri, Dec 10, 2010 at 2:51 PM, darrinps <darri...@gmail.com> wrote:
> > Any suggestions as to how to go about adding padding or margins? I've never
> > dealt with doing that.
>
> I'd probably just set all padding and margins to 0 if you want them to align
> and be flush. These are just properties of the view you can set in the
> Eclipse layout editor.
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment