Anyway, to control the position of the text to turn ToggleButton on and off? For example, I want the text label to stay aligned when it is turned on and right-aligned when turned off.
EDIT: Also, I would include a small addition for the text on the left and right. About 5 dp. and, if possible, finer control over the placement of labels.
ANSWER: This is what I need!
button.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); button.setPadding(0, 0, 5, 0);
source share