I want to align the text in ToogleButton right of this panel, which turned green / white when clicked.
To be more explicit, I will post the code, as well as the result that I have.
<ToggleButton android:id="@+id/ToggleButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" layout_gravity="center_vertical" android:textOff="Off" android:textOn="On"/> ToggleButton onOffButton = (ToggleButton) findViewById(R.id.ToggleButton01); onOffButton.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); onOffButton.setPadding(0, 0, 5, 0);
and the result: 
I want the panel and text to not overlap.
source share