I have a button, and I want to change its gravity of the text in the bottom center. How can I do this programmatically?
I can only find that I can change to the center or bottom, and not both.
Try
setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
Try this code:
your_button.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
for more details below link
http://developer.android.com/reference/android/widget/TextView.html#setGravity(int )