How do I center text horizontally and vertically in a TextView?
I’m assuming you’re using XML layout. You can also use gravity center_vertical or center_horizontal according to your need. As @stealthcopter commented, in java: .setGravity(Gravity.CENTER);. And for Kotlin users, .gravity = Gravity.CENTER