Switch, like CheckBox and ToggleButton, inherits from CompoundButton, and
therefore shares a common API, for methods like toggle(), isChecked(), and
setChecked(). And, as with the others, you can put it in a layout file, as seen in the
Basic/Switch sample: