Slider (lv_slider)
A Bar with a draggable knob; supports range and symmetrical modes.
Overview
The Slider is a Bar with a draggable knob. It can be horizontal or vertical and supports normal, symmetrical and two-knob range modes.
Learn more in the LVGL Open documentation.
Enumerations
lv_slider_mode — How the slider behaves
| Value | Description |
|---|---|
normal | One knob, grows left to right |
range | Two knobs, select a range |
symmetrical | Indicator grows from zero |
lv_slider_orientation — How the slider oriented
| Value | Description |
|---|---|
auto | Decide based on width an height |
horizontal | Always horizontally |
vertical | Always vertical |
Properties
Parts
Style parts of the widget with local style (e.g. style_bg_color-knob="0xff0000") or with style sheets (e.g. <style name="style_knob" selector="knob">). See Styles to learn more.
| Part | Description |
|---|---|
main | The track/background: background properties. padding makes the indicator smaller in the respective direction. |
indicator | The filled portion that shows the value: background properties. |
knob | The draggable handle: background, border, shadow and padding properties. Use knob|pressed for drag feedback; range mode draws two knobs. |
Properties below are the widget's XML <api>; see API for how properties, parameters and elements work.
| Property | Type | Description |
|---|---|---|
min_value | int | Set minimum value. If min_value > max_value fills from the right |
max_value | int | Set maximum value. If min_value > max_value fills from the right |
value | int | Set current value |
value-anim | bool | Animate update (reference as value-anim) (default: false) |
start_value | int | Set start value in range mode |
start_value-anim | bool | Animate update (reference as start_value-anim) (default: false) |
mode | enum:lv_slider_mode | Set slider mode |
bind_value | subject | Bind value to subject |
orientation | enum:lv_slider_orientation | Set the orientation to horizontal, vertical or auto |
Last updated on