Android - Set two Gravity options programmatically

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.

+6
source share
2 answers

Try

setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
+21
source

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 )

0
source

All Articles