How to center text horizontally and vertically in a TextView in Android? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to center text horizontally and vertically in a TextView in Android?

NickFNickF USAPosts: 132Member

Please explain me how to center the text horizontally and vertically in a TextView in android.

Tagged:

Comments

  • DavidMDavidM USAPosts: 342Member

    If you are using XML layout,

    <TextView  
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:gravity="center"
        android:text="@string/**sometext**"
    />
    
Sign In or Register to comment.