Android - Set two Gravity parameters programmatically
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)
In case you are wondering the Kotlin version it is
your_button.gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL
Try
setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);