ToogleButton
そのバーを押すと緑/白になったバーの右側にテキストを揃えたい。
より明確にするために、コードと現在の結果を投稿します。
<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);
そして結果:
バーとテキストが重ならないようにしたい。