If you are just trying to change the way text is displayed inside ToggleButton , you need to configure the android:padding and android:gravity options in XML for your button.
To change the registration, you first need to separate the text from the center by default (because when it centers the indentation, it has no way to take effect). You do this with the android:gravity parameter, which is similar to text-align in CSS.
For instance:
<ToggleButton xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left"> </ToggleButton>
This will align the text to the left of ToggleButton. However, by default, this will also correspond to its vertex, since gravity affects both the x axis and the y axis.
If you want to center vertically and left horizontally, you must do the following:
<ToggleButton xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left|center"> </ToggleButton>
This will give you a centered vertical, but fully mounted to the left on the horizontal scale. This will make the text go to the edge of your button and look unappealing. You need to use alignments in combination with indentation for the text to get it exactly where you want.
For instance:
<ToggleButton xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding_left="10dp" android:gravity="left|center"> </ToggleButton>
This adds an addition only to the left , which means that you can install it as far from the border as you like.
You can play with padding for each side and gravity to scale the text to your needs, but that would be the best approach to control the internal alignment of ToggleButton text.