Text/Layout Alignment in Android (textAlignment, gravity)

Chrizzor picture Chrizzor · Apr 24, 2013 · Viewed 60k times · Source

What's the difference between android:textAlignment and android:gravity?

Answer

stinepike picture stinepike · Apr 24, 2013

All I can see is that the textAlignment is a member of the View Class and the gravity is the member of TextView class. So for the TextView and its subclasses you can use the gravity while you can use the textAlignment for all Views.

As the TextView and its subclasses need some more text-aligning features, so you can see there are more options in gravity where in textAlignment there are only basic options. Although it is only my guess because I have not found any clear documentation about the difference.

You can see these two links of documentation: textAlignment and gravity.