Android Gravity Example

Gravity is used to align a view in proper way. It may helps us in UI part very much. Gravity have some option like top, left, center, right, bottom, center-vertical, etc... You can use any option to gravity according to your UI Design.


Android Textview Aligment

Here we are going to see about how to set textview alignment in Android.

It is very simple to set Android textview alignment to the center, right or left etc..

Example for Android textview alignment -

To align a textview we need to use the 'gravity' property

[sourcecode language="xml"]
<TextView android:text="@+id/TextView01"
android:gravity="center" />

Now we set the alignment to center

Syndicate content