A horizontal or vertical toggle switch with a label
create a new ToggleSwitch.
| parent |
A parent view. |
| bounds |
A Rect. if width>height, a horizontal switch, otherwise vertical. |
| label |
A label text. For vertical swiches omit or make very short. |
| toggleSize |
The size of the toggle widget (width or height). |
| label2 |
An optional second label on the other side of the switch. |
| radius |
a radius size for corners. defualts to \auto . |
a new ToggleSwitch
a convencienc method to create a ToggleSwitch with no rouding or button inset.
a new ToggleSwitch
default:Color.green(0.6);
override individually with onColor
default: Color.grey.alpha_(0.6);
override individually with offColor
All of the setter methods except value and valueAction need you to do myInstance.view.refresh after setting the value;
set the value adm preform the action
All draw function in the class or separated into drawMyMethod methods.
So you can override the methods to add in icon, e.g., if you like.
Execute the code below to test all the features and parameters.