Button , inherited from TextView, is a button that can be clicked, and clicking Triggers an onClick event, followed by a specific event listener.
The radio button RadioButton and check box checkboxes are inherited from the button, and areused as the name says.
RadioButton needs to be used with radiogroup to define a set of radio button.
Status Switch button ToggleButton and switch switches are also inherited from button, they all provide two states, Typically used to toggle a state in a program.
XML attributes and related methods supported by ToggleButton
XML Properties |
Related methods |
Description |
Android:checked |
Setchecked (Boolean) |
Sets whether the button is selected |
Android:textoff |
|
Set the text to display when the state is closed |
Android:texton |
|
Set the text that is displayed when the status is turned on |
XML attributes and related methods supported by Switch
XML Properties |
Related methods |
Description |
Android:switchminwidth |
Setswitchminwidth (int) |
Set the minimum width of the switch |
Android:switchpadding |
setswitchpadding (int) |
Set the gap between the switch and the caption text |
Android:switchtextappearance |
Setswitchtextappearance (Context,int) |
Set the text style on the switch icon |
Android:textoff |
Settextoff (charsequence) |
Set the text to display when the state is closed |
Android:texton |
Settexton (charsequence) |
Set the text that is displayed when the status is turned on |
Android:textstyle |
Setswitchtypeface (Typeface) |
Set the text style of the switch |
Android:thumb |
Setthumbresource (int) |
Draw a switch button using a custom drawable |
Android:thumbtextpadding |
setthumbtextpadding (int) |
Set the white space between the button and the caption text |
Android:track |
Settrackresource (int) |
draw a switch track using a custom drawable |
Android:typeface |
Setswitchtypeface (Typeface) |
Set the font style of the switch text |
Thoughts on Android (19): Button buttons and their subclasses