更改切换buttonAndroid的开启/closures文字
我只是改变了一个ToggleButton的背景 ,现在我正在寻找改变它的开启/closures文本。 什么是最简单的方法来做到这一点? 
您可以使用以下代码来设置文本:
 toggleButton.setText(textOff); // Sets the text for when the button is first created. toggleButton.setTextOff(textOff); // Sets the text for when the button is not in the checked state. toggleButton.setTextOn(textOn); // Sets the text for when the button is in the checked state. 
要使用xml设置文本,请使用以下命令:
 android:textOff="The text for the button when it is not checked." android:textOn="The text for the button when it is checked." 
这些信息来自这里
 在你链接的例子中,他们正在使用android:textOn和android:textOff将其更改为Day / Night 
将XML设置为:
 <ToggleButton android:id="@+id/flashlightButton" style="@style/Button" android:layout_above="@+id/buttonStrobeLight" android:layout_marginBottom="20dp" android:onClick="onToggleClicked" android:text="ToggleButton" android:textOn="Light ON" android:textOff="Light OFF" /> 
看来你不再需要toggleButton.setTextOff(textOff); 和toggleButton.setTextOn(textOn);. 每个切换状态的文本将仅通过包含相关的xml特性而改变。 这将覆盖默认的开/关文本。
 <ToggleButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/toggleText" android:textOff="ADD TEXT" android:textOn="CLOSE TEXT" android:layout_centerHorizontal="true" android:layout_marginTop="10dp" android:visibility="gone"/> 
是的,你可以改变开/关button
  android:textOn="Light ON" android:textOff="Light OFF" 
请参阅更多
http://androidcoding.in/2016/09/11/android-tutorial-toggle-button