Switch¶
Category | Requires | Version |
---|---|---|
User Interface | API 21, Android 5.0 Lollipop | 4 |
Overview¶
A visible component that lets the user toggle between two states — on and off.
Events¶
Clicked¶
Event invoked when a switch has been clicked. Returns true or false if the switch is checked or not.
Params | |
---|---|
is Checked | Boolean |
Methods¶
Thumb Image¶
Set the drawable used for the switch 'thumb' - the piece that the user can physically touch and drag along the track. If 'color Filter Enabled' is set to true, the image will get a light tint filter with the same color that you used as thumb color.
Params | |
---|---|
image | Text |
Thumb Image From Material Font¶
Set the drawable used for the switch 'thumb' - the piece that the user can physically touch and drag along the track. You can find the icon name (or code) here at https://material.io/icons . Use as size as example '300'.
Params | |
---|---|
icon Name | Text |
size | Number |
Properties¶
Checked¶
Boolean Default: False Write - Designer Blocks
Set the toggle to checked or unchecked
Enabled¶
Boolean Default: True Read Write - Designer Blocks
If set to true, user can touch the switch.
Font Bold¶
Boolean Default: False Write - Designer
Property for FontBold
Font Italic¶
Boolean Default: False Write - Designer
Property for FontItalic
Font Size¶
Number Default: 14.0 Read Write - Designer Blocks
The text size of the switch.
Font Typeface¶
Number Default: 0 Write - Designer
Property for FontTypeface
Font Typeface Import¶
Available as Advanced Property
Text Write - Designer Blocks
Set a custom font.
Height¶
Number Read Write - Blocks
Specifies the component's vertical height, measured in pixels.
Height Percent¶
Number Write - Blocks
Specifies the component's vertical height as a percentageof the height of its parent Component.
is Checked¶
Boolean Read - Blocks
Return true if the switch is checked else false.
Text Color¶
Color Default: #4CAF50FF Read Write - Designer Blocks
Set the text color for the switch.
Text Off¶
Text Default: Switch Off Read Write - Designer Blocks
Set here the switch off text. HTML tags are too possible: , , ,
, , ,
Text On¶
Text Default: Switch On Read Write - Designer Blocks
Set here the switch on text. HTML tags are too possible: , , ,
, , ,
Thumb Color¶
Color Default: #4CAF50FF Read Write - Designer Blocks
Change the disabled color of the switch.
Track Color¶
Color Default: #009688FF Read Write - Designer Blocks
Change the enabled color of the switch.
Visible¶
Boolean Default: True Read Write - Designer Blocks
Returns true iff the component is visible.
Width¶
Number Read Write - Blocks
Specifies the component's horizontal width, measured in pixels.
Width Percent¶
Number Write - Blocks
Specifies the component's horizontal width as a percentageof the Width of its parent Component.