Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 切换按钮中的曲目文本_Java_Android_Button - Fatal编程技术网

Java 切换按钮中的曲目文本

Java 切换按钮中的曲目文本,java,android,button,Java,Android,Button,请,有人知道我如何在切换按钮的轨道部分设置文本,我需要用java代码而不是xml代码来完成。 假设这是用于Android开关按钮,您可以使用以下选项: //sets text on creation toggleButton.setText(textOff); // Sets the text for when the button off. toggleButton.setTextOff(textOff); // Sets the text for when the button is o

请,有人知道我如何在切换按钮的轨道部分设置文本,我需要用java代码而不是xml代码来完成。

假设这是用于Android开关按钮,您可以使用以下选项:

//sets text on creation
toggleButton.setText(textOff);

// Sets the text for when the button off.
toggleButton.setTextOff(textOff);

// Sets the text for when the button is on.
toggleButton.setTextOn(textOn);

对android来说是的,这个答案是针对拇指文本的,但我正在搜索在切换按钮的轨迹部分添加文本的方法。