Right align text in android TextView

Bishan picture Bishan · Jan 23, 2012 · Viewed 375.6k times · Source

I have a TextView in my application. I want to align the text in it to the right. I tried adding:

android:gravity="right"

But this doesn't work for me.

What might I be doing wrong?

Answer

a fair player picture a fair player · Jan 23, 2012

I think that you are doing this: android:layout_width = "wrap_content"
If this is the case, do this: android:layout_width = "match_parent"