Hi,
I think I've lost enough hair over this, so now I'll ask. What is the
difference between those attributes? According to the documentation of
R.attr, there isn't any difference (doc text is exactly the same, see
http://developer.android.com/reference/android/R.attr.html), but
apparently, that's simply not true. For example, the gravity attribute
can be used on EditText to set the text alignment (e.g. left, center,
right).
I often found that neither of them work to align a view at all. For
example, I need to float two text views in a relative layout, one
going to the left below a title bar, the other going to the right
below the title bar. So what I did was this:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- the title bar -->
<ImageView ...
</ImageView>
<TextView android:id="@+id/left_text"
android:layout_below="@id/title_bar"
android:layout_gravity="left"
...
/>
<TextView android:id="@+id/right_text"
android:layout_below="@id/title_bar"
android:layout_gravity="right"
...
/>
</RelativeLayout>
That doesn't work, however. The left text is indeed aligned to the
left inside its parent (the relative layout), but the right text is
not aligned to the right; instead, it's placed directly to the right
of the left text.
Why's that?
Thanks,
Matthias
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---