Image Button (lv_imagebutton)

A button that draws per-state images instead of a styled rectangle.

Overview

The Image Button behaves like a Button but draws user-supplied images per state instead of a styled rectangle. Separate left, middle and right images can be set; the middle image is tiled to fill the width.

Learn more in the LVGL Open documentation.

Enumerations

lv_imagebutton_state — Possible states of an image button

ValueDescription
releasedReleased
pressedPressed
disabledDisabled
checked_releasedChecked and released
checked_pressedChecked and pressed
checked_disabledChecked and disabled

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.

PartDescription
mainStyle the button: background, text and image_recolor/image_recolor_opa properties. The shown left/mid/right images change with the state (released, pressed, disabled, checked_*).

Properties below are the widget's XML <api>; see API for how properties, parameters and elements work.

PropertyTypeDescription
stateenum:lv_imagebutton_stateThe current state of the imagebutton

<lv_imagebutton-src_left>

Set the left image source in a given state

access set

NameKindTypeDescription
stateargenum:lv_imagebutton_stateSet the image in this state
srcargimageThe image in the given state

<lv_imagebutton-src_right>

Set the right image source in a given state

access set

NameKindTypeDescription
stateargenum:lv_imagebutton_stateSet the image in this state
srcargimageThe image in the given state

<lv_imagebutton-src_mid>

Set the middle image source in a given state

access set

NameKindTypeDescription
stateargenum:lv_imagebutton_stateSet the image in this state
srcargimageThe image in the given state

Last updated on

On this page