Android - Set two Gravity parameters programmatically

android, android-layout

Solution

Try

setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);

Problem

I have button and want to change its text gravity to bottom center. How can I do that programmatically? I can only find that I can change to center OR bottom, not both.

Original source