HOW DO I CENTER TEXT HORIZONTALLY AND VERTICALLY IN A TEXTVIEW IN ANDROID?

ezra heywood

Total Post:145

Points:1019
Posted by  ezra heywood
 807  View(s)
Ratings:
Rate this:
How do I center the text horizontally and vertically in a TextView in Android, so that it appears exactly in the middle of the TextView
  1. Mayank Tripathi

    Post:397

    Points:3117
    Re: How do I center text horizontally and vertically in a TextView in Android?

    Use:

    android:gravity="center" 
    in your TextView  tags xml
    The textview has to be match_parent or fill_parent for this to work. If its wrap content, then it will not center.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!