--ADVERTISEMENT--

In this simple tip, I will show you to align android TextView in the center of the screen. To align android textview in the center of screen, you have to use android:gravity=”center” xml attribute.

Related:
Programmatically Align Android TextView in the Center of the Screen
How to Set Android Button and TextView Border Color
How to Implement Ripple Effect in Android

XML Layout File

Following is the code of xml layout file.
res/layout/textview_center.xml

Output:

How to Align Android TextView in the Center of the Screen
Android TextView in the Center of the Screen

Post a Comment

Powered by Blogger.