Switch
Definition
Switch
components can detect user taps and can change their boolean state in response. They are identical to CheckBox
es except in appearance.
Switches have an on (true) state and an off (false) state. A Switch
component raises an event when the user taps it to toggle between states.
Properties
- BackgroundColor
- Specifies the background color of the
Switch
as an alpha-red-green-blue integer. - Enabled
- Specifies whether the
Switch
should be active and clickable. - FontBold
- Specifies whether the text of the
Switch
should be bold. Some fonts do not support bold. - FontItalic
- Specifies whether the text of the
Switch
should be italic. Some fonts do not support italic. - FontSize
- Specifies the text font size of the
Switch
, measured in sp(scale-independent pixels). - FontTypeface
- Specifies the text font face of the
Switch
as default, serif, sans serif, or monospace. - Height
- Specifies the
Switch
’s vertical height, measured in pixels. - HeightPercent
- Specifies the
Switch
’s vertical height as a percentage of theScreen
’sHeight
. - On
- True if the switch is in the On state, false otherwise.
- Text
- Specifies the text displayed by the
Switch
. - TextColor
- Specifies the text color of the
Switch
as an alpha-red-green-blue integer. - ThumbColorActive
- Specifies the
Switch
’s thumb color when switch is in the On state. - ThumbColorInactive
- Specifies the
Switch
’s thumb color when switch is in the Off state. - TrackColorActive
- Specifies the
Switch
’s track color when in the On state. - TrackColorInactive
- Specifies the
Switch
’s track color when in the Off state. - Visible
- Specifies whether the
Switch
should be visible on the screen. Value istrue
if theSwitch
is showing andfalse
if hidden. - Width
- Specifies the horizontal width of the
Switch
, measured in pixels. - WidthPercent
- Specifies the horizontal width of the
Switch
as a percentage of theScreen
’sWidth
.