07.01.2013 Views

David Defour - Université de Perpignan

David Defour - Université de Perpignan

David Defour - Université de Perpignan

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TOGGLEBUTTON<br />

• I<strong>de</strong>a<br />

• A button with two states (checked and unchecked)<br />

• Has visual indicator to show whether it is checked<br />

• In Java, use isChecked() to <strong>de</strong>termine state. Use setChecked to programmatically change the state.<br />

• Has different text for each state (unlike CheckBox)<br />

• Main Listener types<br />

• View.OnClickListener<br />

• No Listener at all<br />

• Take no action when ToggleButton is clicked, but instead query the ToggleButton later to find if it is<br />

checked or not<br />

• Key XML attributes<br />

• android:textOn, android:textOff<br />

• The text for the two states. If you omit this, then the text is automatically ON and OFF (in caps)<br />

• android:onClick<br />

• Same as in previous examples<br />

jeudi 26 janvier 12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!