Wednesday, February 19, 2014

Android togglebutton implementation issues


android: id = "@ + id/toggleButton1"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: text = "ToggleButton" />


In the Activity starts, the default is to have a word switch "on / off", but I want to achieve is in oncreat () inside with XX.setTextOn ("switch status"); to realize that in case of default I set "switch status" instead of android: textOn = "ON /" this way.

Statement, which if used in ACtivity SET method, it is only when you click the button, set the status will be displayed on the switch. I want to achieve before the touch screen does not click switch, the switch is already on the text of the SET, and has been confirmed in experiments is of no use to refresh the start of the Activity.

Consult Great God, how<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
In onCreate which set about setTextOn and setTextOff on it, if not, it is estimated elsewhere wrong
Reply:
cited a floor youngc527 reply:
in onCreate which set about setTextOn and setTextOff on it, if not, the estimate is wrong elsewhere



You can try, I tried not, that is the time to start ACTIVITY display SetTextOn () to set the text inside the
Reply:
reference to the second floor liu332355559 reply:
Quote: references to a floor youngc527 reply:

In onCreate which set about setTextOn and setTextOff on it, if not, it is estimated elsewhere wrong



You can try, I tried not, that is the time to start ACTIVITY display SetTextOn () which set text


Sorry, buddy, just tried it, really a little problem.
Need to set about checked, can take effect

 
ToggleButton button = (ToggleButton) findViewById (R.id.button);
button.setTextOn ("AAA");
button.setTextOff ("BBB");
button.setChecked (true);
button.setOnCheckedChangeListener (this);



Reply:
reference to the third floor youngc527 reply:
Quote: references to the second floor liu332355559 reply:

Quote: references to a floor youngc527 reply:

In onCreate which set about setTextOn and setTextOff on it, if not, it is estimated elsewhere wrong



You can try, I tried not, that is the time to start ACTIVITY display SetTextOn () which set text


Sorry, buddy, just tried it, really a little problem.
Need to set about checked, can take effect

 
ToggleButton button = (ToggleButton) findViewById (R.id.button);
button.setTextOn ("AAA");
button.setTextOff ("BBB");
button.setChecked (true);
button.setOnCheckedChangeListener (this);







Er er, it became under. . . 3Q

No comments:

Post a Comment