how to get text to the center in android code example
Example 1: android studio text alignment center
set the 'gravity' attribute center_horizontal and center_vertical
Example 2: android textview center align text programmatically
yourTextView.setGravity(Gravity.CENTER);