Switch
Switch states in a column
Four switches covering the default, checked, disabled, and checked-disabled states.
The active screen is set to LV_FLEX_FLOW_COLUMN with centered flex
alignment and holds four switches: a default one with
LV_OBJ_FLAG_EVENT_BUBBLE set, a LV_STATE_CHECKED switch, a
LV_STATE_DISABLED switch, and one with both states combined. Each one
subscribes to LV_EVENT_ALL and logs On or Off on
LV_EVENT_VALUE_CHANGED based on lv_obj_has_state(..., LV_STATE_CHECKED).
Vertical switch orientation
Two 30 x 60 switches, one horizontal and one forced to vertical orientation.
The active screen is laid out as LV_FLEX_FLOW_ROW with centered flex
alignment. Both switches are sized 30 x 60 so one is taller than it is
wide; the first keeps the default orientation while the second calls
lv_switch_set_orientation(..., LV_SWITCH_ORIENTATION_VERTICAL) and starts
in LV_STATE_CHECKED. A shared callback logs On or Off on
LV_EVENT_VALUE_CHANGED.
How is this guide?
Last updated on