You can add a basic toggle button to your layout with theToggleButton
object. Android 4.0 (API level 14) introduces another kind of toggle button called a switch that provides a slider control, which you can add with a Switch
object.

Toggle buttons

Switches (in Android 4.0+)
SwitchButton,开关按钮,可自定义。