Logo
8.1
  • Introduction (介绍)
    • Key features (主要特性)
    • Requirements(配置要求)
    • License(许可证)
    • Repository layout (仓库布局)
    • Release policy(发布策略)
      • Release cycle(发布周期)
      • Branches(分支)
      • Changelog(变更日志)
      • Version support(版本支持)
    • FAQ(常见问题)
      • Where can I ask questions?(我可以在哪里提问?)
      • Is my MCU/hardware supported?(LVGL是否支持我的 MCU/硬件?)
      • Is my display supported?(支持我的显示器吗?)
      • Nothing happens, my display driver is not called. What have I missed?(没有任何反应,我的显示驱动程序没有被调用。我错过了什么?)
      • Why the display driver is called only once? Only the upper part of the display is refreshed. (为什么显示驱动程序只调用一次?仅刷新显示的上部。)
      • Why I see only garbage on the screen?(为什么我在屏幕上只看到垃圾?)
      • Why I see non-sense colors on the screen? (为什么我在屏幕上看到无意义的颜色?)
      • How to speed up my UI?(如何加速我的用户界面?)
      • How to reduce flash/ROM usage?(如何减少闪存/ROM的使用?)
      • How to reduce the RAM usage(如何减少内存使用)
      • How to work with an operating system?(如何使用操作系统?)
  • Examples
    • Get started
    • Styles
      • Size styles
      • Background styles
      • Border styles
      • Outline styles
      • Shadow styles
      • Image styles
      • Text styles
      • Line styles
      • Transition
      • Using multiple styles
      • Local styles
      • Add styles to parts and states
      • Extending the current theme
    • Animations
    • Events
      • Button click event
      • Handle multiple events
      • Event bubbling
    • Layouts
      • Flex
      • Grid
    • Scrolling
    • Widgets
      • Base object
        • Base objects with custom styles
        • Make an object draggable
      • Arc
        • Simple Arc
        • Loader with Arc
      • Bar
        • Simple Bar
        • Styling a bar
        • Temperature meter
        • Stripe pattern and range value
        • Bar with LTR and RTL base direction
        • Custom drawer to show the current value
      • Button
        • Simple Buttons
        • Styling buttons
        • Gummy button
      • Button matrix
        • Simple Button matrix
        • Custom buttons
        • Pagination
      • Calendar
        • Calendar with header
      • Canvas
        • Drawing on the Canvas and rotate
        • Transparent Canvas with chroma keying
      • Chart
        • Line Chart
        • Faded area line chart with custom division lines
        • Axis ticks and labels with scrolling
        • Show the value of the pressed points
        • Display 1000 data points with zooming and scrolling
        • Show cursor on the clicked point
        • Scatter chart
        • Stacked area chart
      • Checkbox
        • Simple Checkboxes
        • Checkboxes as radio buttons
      • Colorwheel
        • Simple Colorwheel
      • Dropdown
        • Simple Drop down list
        • Drop down in four directions
        • Menu
      • Image
        • Image from variable and symbol
        • Image recoloring
        • Rotate and zoom
        • Image offset and styling
      • Image button
        • Simple Image button
      • Keyboard
        • Keyboard with text area
      • Label
        • Line wrap, recoloring and scrolling
        • Text shadow
        • Show LTR, RTL and Chinese texts
        • Draw label with gradient color
      • LED
        • LED with custom style
      • Line
        • Simple Line
      • List
        • Simple List
        • Sorting a List using up and down buttons
      • Meter
        • Simple meter
        • A meter with multiple arcs
        • A clock from a meter
        • Pie chart
      • Message box
        • Simple Message box
      • Roller
        • Simple Roller
        • Styling the roller
        • add fade mask to roller
      • Slider
        • Simple Slider
        • Slider with custom style
        • Slider with extended drawer
      • Span
        • Span with custom styles
      • Spinbox
        • Simple Spinbox
      • Spinner
        • Simple spinner
      • Switch
        • Simple Switch
      • Table
        • Simple table
        • Lightweighted list from table
      • Tabview
        • Simple Tabview
        • Tabs on the left, styling and no scrolling
      • Textarea
        • Simple Text area
        • Text area with password field
        • Text auto-formatting
      • Tabview
        • Tileview with content
      • Window
        • Simple window
  • Get started(开始)
    • Where to look first?(先去哪里看?)
    • Platform-specific tutorials(基于特定于平台的教程)
      • Simulator
        • Select an IDE(选择适合的IDE)
        • Set-up Eclipse CDT(使用 Eclipse CDT 开发)
      • NXP
        • Creating new project with LVGL(使用 LVGL 创建新项目)
        • Adding HW acceleration for NXP iMX RT platforms using PXP (PiXel Pipeline) engine for existing projects
      • Espressif (ESP32)
        • Get the LVGL demo project for ESP32(获取 ESP32 的 LVGL 演示项目)
        • Use LVGL in your ESP32 project(在 ESP32 项目中使用 LVGL)
        • Use lvgl_esp32_drivers in your project(在您的项目中使用 lvgl_esp32_drivers)
      • Arduino
        • Get the LVGL Arduino library(获取 LVGL Arduino 库)
        • Set up drivers(设置驱动程序)
        • Configure LVGL(配置LVGL)
        • Initialize LVGL and run an example(初始化 LVGL 并运行示例)
        • Debugging and logging(调试和日志)
      • Tasmota-Berry
      • Micropython
        • What is Micropython?(什么是Micropython?)
        • Why Micropython + LVGL?(为什么是 Micropython + LVGL?)
        • So what does it look like?(它看起来像什么?)
        • How can I use it?(我怎样才能使用它?)
        • Where can I find more information?(我在哪里可以找到更多的信息?)
      • NuttX RTOS
        • What is NuttX?(什么是NuttX)
        • Why NuttX + LVGL?(为什么是 NuttX + LVGL?)
        • How to get started with NuttX and LVGL?(如何开始使用 NuttX 和 LVGL?)
        • Where can I find more information?(我在哪里可以找到更多信息?)
      • CMake
      • Quick overview (快速概览)
        • Get started in a simulator(从模拟器开始)
        • Add LVGL into your project(将 LVGL 添加到您的项目中)
        • Learn the basics(学习基础知识)
        • Examples
        • Micropython
      • Simulator on PC(PC上的模拟器)
        • Select an IDE(选择适合的IDE)
        • Set-up Eclipse CDT(使用 Eclipse CDT 开发)
      • STM32
      • NXP
        • Creating new project with LVGL(使用 LVGL 创建新项目)
        • Adding HW acceleration for NXP iMX RT platforms using PXP (PiXel Pipeline) engine for existing projects
      • Espressif (ESP32)
        • Get the LVGL demo project for ESP32(获取 ESP32 的 LVGL 演示项目)
        • Use LVGL in your ESP32 project(在 ESP32 项目中使用 LVGL)
        • Use lvgl_esp32_drivers in your project(在您的项目中使用 lvgl_esp32_drivers)
      • Arduino
        • Get the LVGL Arduino library(获取 LVGL Arduino 库)
        • Set up drivers(设置驱动程序)
        • Configure LVGL(配置LVGL)
        • Initialize LVGL and run an example(初始化 LVGL 并运行示例)
        • Debugging and logging(调试和日志)
      • Micropython
        • What is Micropython?(什么是Micropython?)
        • Why Micropython + LVGL?(为什么是 Micropython + LVGL?)
        • So what does it look like?(它看起来像什么?)
        • How can I use it?(我怎样才能使用它?)
        • Where can I find more information?(我在哪里可以找到更多的信息?)
      • Tasmota and berry
      • NuttX RTOS
        • What is NuttX?(什么是NuttX)
        • Why NuttX + LVGL?(为什么是 NuttX + LVGL?)
        • How to get started with NuttX and LVGL?(如何开始使用 NuttX 和 LVGL?)
        • Where can I find more information?(我在哪里可以找到更多信息?)
      • CMake
  • Porting(移植)
    • Set-up a project(设置项目)
      • Get the library(获取LVGL图形库)
      • Configuration file(修改配置文件)
      • Initialization(初始化)
    • Display interface(显示接口)
      • Draw buffer(绘制缓冲区)
      • Display driver(显示驱动程序)
        • Mandatory fields(必须要适配的部分)
        • Optional fields (可选的部分)
        • Examples(示例)
      • Rotation(旋转屏幕)
      • Further reading(深入学习)
      • API
    • Input device interface(输入设备接口)
      • Types of input devices(输入设备的类型)
        • Touchpad, mouse or any pointer(触摸板、鼠标或任何指针)
        • Keypad or keyboard(键盘或键盘)
        • Encoder(编码器)
        • Button(按钮)
      • Other features(其它功能)
        • Parameters(参数)
        • Feedback(回调处理)
        • Associating with a display(与显示器关联)
        • Buffered reading(缓冲读取)
      • Further reading(深入学习)
      • API
    • Tick interface(心跳接口)
      • API
    • Task Handler(任务处理器)
    • Sleep management(睡眠管理)
    • Operating system and interrupts(操作系统和中断)
      • Tasks and threads(任务和线程)
      • Interrupts(中断)
    • Logging(日志)
      • Log level(日记等级)
      • Printing logs(打印日志)
        • Logging with printf(使用 printf 记录)
        • Custom log function(自定义日志功能)
      • Add logs(添加日志)
  • Overview(概览)
    • Objects(对象)
      • Attributes(属性)
        • Basic attributes(基本属性)
        • Specific attributes(特定属性)
      • Working mechanisms(工作机制)
        • Parent-child structure(父子结构)
        • Moving together(一起移动)
        • Visibility only on the parent(仅在父对象上可见)
        • Create and delete objects(创建和删除对象)
      • Screens(屏幕)
        • Create screens(创建屏幕)
        • Get the active screen(获取活动屏幕)
        • Load screens(加载屏幕)
        • Layers(层)
        • Handling multiple displays(处理多个显示器)
      • Parts(部分)
      • States(状态)
      • Snapshot(快照)
    • Positions, sizes, and layouts(位置、大小和布局)
      • Overview(概述)
        • Units(单位)
        • Boxing model(盒子模型)
        • Important notes(重要笔记)
      • Position(位置)
        • Simple way(最简单的方法)
        • Align(对齐)
      • Size(大小)
        • Simple way(最简单的方法)
      • Using styles(使用样式)
      • Translation(风格样式转换)
      • Transformation(转换)
        • Min and Max size(最小和最大尺寸)
      • Layout(布局)
        • Overview(概述)
        • Built-in layout
        • Flags(标志)
        • Adding new layouts(添加新布局)
      • Examples
    • Styles(风格样式)
      • States(状态)
      • Cascading styles(层叠样式)
      • Inheritance(继承)
      • Parts
      • Initialize styles and set/get properties(初始化样式和设置/获取属性)
      • Add and remove styles to a widget(向部件添加和删除样式)
        • Add styles(添加样式)
        • Remove styles(删除样式)
        • Report style changes(通知样式更改)
        • Get a property's value on an object(获取对象的属性值)
      • Local styles(本地样式)
      • Properties(属性)
        • Typical background properties(典型的背景属性)
      • Transitions(过渡特效)
      • Color filter(色彩过滤)
      • Themes(主题)
        • Extending themes(扩展主题)
      • Examples
        • Size styles
        • Background styles
        • Border styles
        • Outline styles
        • Shadow styles
        • Image styles
        • Arc styles
        • Text styles
        • Line styles
        • Transition
        • Using multiple styles
        • Local styles
        • Add styles to parts and states
        • Extending the current theme
      • API
    • Style properties
      • Size and position
        • width
        • min_width
        • max_width
        • height
        • min_height
        • max_height
        • x
        • y
        • align
        • transform_width
        • transform_height
        • translate_x
        • translate_y
        • transform_zoom
        • transform_angle
      • Padding
        • pad_top
        • pad_bottom
        • pad_left
        • pad_right
        • pad_row
        • pad_column
      • Miscellaneous
        • radius
        • clip_corner
        • opa
        • color_filter_dsc
        • color_filter_opa
        • anim_time
        • anim_speed
        • transition
        • blend_mode
        • layout
        • base_dir
      • Background
        • bg_color
        • bg_opa
        • bg_grad_color
        • bg_grad_dir
        • bg_main_stop
        • bg_grad_stop
        • bg_img_src
        • bg_img_opa
        • bg_img_recolor
        • bg_img_recolor_opa
        • bg_img_tiled
      • Border
        • border_color
        • border_opa
        • border_width
        • border_side
        • border_post
      • Text
        • text_color
        • text_opa
        • text_font
        • text_letter_space
        • text_line_space
        • text_decor
        • text_align
      • Image
        • img_opa
        • img_recolor
        • img_recolor_opa
      • Outline
        • outline_width
        • outline_color
        • outline_opa
        • outline_pad
      • Shadow
        • shadow_width
        • shadow_ofs_x
        • shadow_ofs_y
        • shadow_spread
        • shadow_color
        • shadow_opa
      • Line
        • line_width
        • line_dash_width
        • line_dash_gap
        • line_rounded
        • line_color
        • line_opa
      • Arc
        • arc_width
        • arc_rounded
        • arc_color
        • arc_opa
        • arc_img_src
    • Scroll(滚动)
      • Overview(概述)
        • Scrollbar(滚动条)
        • Events(事件)
      • Basic example(基本示例)
      • Features of scrolling(滚动的特点)
        • Scrollable(滚动效果)
        • Scroll chain(滚动条)
        • Scroll momentum(滚动惯性效果)
        • Elastic scroll(弹性卷轴效果)
        • Snapping(捕捉)
        • Scroll one(只滚动一个)
        • Scroll on focus(滚动焦点)
      • Scroll manually
      • Self size(自身尺寸)
      • Examples
    • Layers(图层)
      • Order of creation(图层顺序)
      • Bring to the foreground(前台展示)
      • Top and sys layers(顶层和系统层)
    • Events(事件)
      • Add events to the object
      • Remove event(s) from an object(从对象中删除事件)
      • Event codes
        • Input device events(输入设备事件)
        • Drawing events(绘图事件)
        • Other events(其他事件)
        • Special events(特殊事件)
        • Custom events(自定义事件)
      • Sending events(发送事件)
        • Refresh event(刷新事件)
      • Fields of lv_event_t(lv_event_t 的字段)
      • Event bubbling(事件冒泡)
      • Examples
        • Button click event
        • Handle multiple events
        • Event bubbling
    • Input devices(输入设备)
      • Pointers(光标)
        • Gestures (手势)
      • Keypad and encoder(键盘和编码器)
        • Groups(组)
        • Styling(风格样式)
      • API
        • Input device(输入设备)
        • Groups(组)
    • Displays(显示)
      • Multiple display support(多显示器支持)
        • Using only one display(仅使用一个显示器)
        • Mirror display(镜像显示)
        • Split image(分割图像)
      • Screens(屏幕)
        • Transparent screens(透明屏幕)
      • Features of displays(显示器的特点)
        • Inactivity(不活动)
        • Background(背景)
      • API
    • Colors(颜色)
      • Creating colors(创造色彩)
        • RGB(三原色)
        • HSV(色调饱和值-Hue Saturation Value)
        • Palette(调色板)
        • Modify and mix colors(修改和混合颜色)
        • Built-in colors(内置颜色)
      • Opacity(不透明度)
      • Color types(颜色类型)
        • Convert color(颜色转换)
      • API
    • Fonts(字体)
      • Unicode support(支持Unicode编码)
      • Built-in fonts(内置字体)
        • Normal fonts(普通字体)
        • Special fonts(特殊字体)
      • Special features(特殊功能)
        • Bidirectional support(双向支持)
        • Arabic and Persian support(阿拉伯语和波斯语支持)
        • Subpixel rendering(亚像素渲染)
        • Compress fonts(压缩字体)
      • Add new font(添加新字体)
      • Add new symbols(添加新符号)
      • Load font at run-time(在运行时加载字体)
      • Add a new font engine(添加新的字体引擎)
    • Images(图象)
      • Store images(存储图像)
        • Variables(变量)
        • Files(文件)
      • Color formats(颜色格式)
      • Add and use images(添加和使用图像)
        • Online converter(在线转换器)
        • Manually create an image(手动创建图像)
        • Use images(使用图片)
      • Image decoder(图像解码器)
        • Custom image formats(自定义图像格式)
        • Register an image decoder(注册图像解码器)
        • Manually use an image decoder(手动使用图像解码器)
      • Image caching(图片缓存)
        • Cache size(缓存大小)
        • Value of images(图片的价值)
        • Memory usage(内存使用情况)
        • Clean the cache(清理缓存)
      • API
        • Image buffer(图像缓冲区)
    • File system(文件系统)
      • Ready to use drivers(准备使用驱动程序)
      • Add a driver(添加驱动程序)
        • Registering a driver(注册驱动)
        • Implementing the callbacks(实现回调)
        • Other callbacks(其他回调)
      • Usage example(使用示例)
      • Use drivers for images(使用图像驱动程序)
      • API
    • Animations(动画)
      • Create an animation(创建动画)
      • Animation path(动画轨迹)
      • Speed vs time(速度与时间)
      • Delete animations(删除动画)
      • Timeline(时间线)
      • Examples
      • API
    • Timers(定时器)
      • Create a timer(创建定时器)
      • Ready and Reset(准备与重置)
      • Set parameters(参数设置)
      • Repeat count(设置重复次数)
      • Measure idle time(测量空闲时间)
      • Asynchronous calls(异步调用)
      • API
    • Drawing(绘画)
      • Mechanism of screen refreshing(屏幕刷新机制)
      • Masking(蒙版)
      • Hook drawing(挂钩绘图)
        • Main drawing(主图)
        • Post drawing(后绘图)
        • Part drawing(零件绘图)
        • Others(其他)
    • New widget
  • Widgets(部件)
    • Base object(基础对象) (lv_obj)
      • Overview
        • Coordinates(坐标)
        • Parents and children(父母和孩子)
        • Display and Screens(显示和屏幕)
        • Events(事件)
        • Styles(样式)
        • Flags(宏开关)
        • Groups
        • Extended click area(拓展的点击区域)
      • Events(事件)
      • Keys
      • Example
        • Base objects with custom styles
        • Make an object draggable
      • API
    • Core widgets(核心部件)
      • Arc(弧) (lv_arc)
        • Overview(概述)
        • Parts and Styles
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Bar(进度条) (lv_bar)
        • Overview(概述)
        • Parts and Styles(零件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Button(按钮) (lv_btn)
        • Overview
        • Parts and Styles(零件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Button matrix(按钮矩阵) (lv_btnmatrix)
        • Overview(概述)
        • Parts and Styles(零件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Canvas(画布) (lv_canvas)
        • Overview(概述)
        • Parts and Styles(零件和风格)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Checkbox(复选框) (lv_checkbox)
        • Overview(概述)
        • Parts and Styles(部件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Drop-down list(下拉列表) (lv_dropdown)
        • Overview(概述)
        • Parts and Styles(部件和样式)
        • Usage(用法)
        • Overview(概述)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Image(图象) (lv_img)
        • Overview(概述)
        • Parts and Styles(部件和风格)
        • Usage(用法)
        • Transformations(转换)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Label(标签) (lv_label)
        • Overview(概述)
        • Parts and Styles(部件和风格)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Line(线) (lv_line)
        • Overview(概述)
        • Parts and Styles(零件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Roller(滚轮) (lv_roller)
        • Overview(概述)
        • Parts and Styles(零件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Slider(滑杆) (lv_slider)
        • Overview(概述)
        • Parts and Styles(部件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Switch(开关) (lv_switch)
        • Overview(概述)
        • Parts and Styles(零件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Table(表) (lv_table)
        • Overview
        • Parts and Styles(部件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
      • Text area(文本框) (lv_textarea)
        • Overview(概述)
        • Parts and Styles(部件和样式)
        • Usage(用法)
        • Events(事件)
        • Keys(按键)
        • Example
        • API
    • Extra widgets
      • Animation Image (lv_animimg)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Calendar (lv_calendar)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Headers
        • Example
        • API
      • Chart (lv_chart)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Color wheel (lv_colorwheel)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Image button (lv_imgbtn)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Keyboard (lv_keyboard)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Examples
        • API
      • LED (lv_led)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • List (lv_list)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Menu (lv_menu)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Meter (lv_meter)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Message box (lv_msgbox)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Span (lv_span)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Spinbox (lv_spinbox)
        • Overview
        • Parts and Styles
        • Events
        • Keys
        • Example
        • API
        • Example
      • Spinner (lv_spinner)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Tabview (lv_tabview)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Tile view (lv_tileview)
        • Overview
        • Parts and Styles
        • Usage
        • Events
        • Keys
        • Example
        • API
      • Window (lv_win)
        • Overview
        • Parts and Styles
        • Usage
        • Get the parts
        • Events
        • Keys
        • Example
        • API
  • Layouts(布局)
    • Flex(弹性布局)
      • Overview(概述)
      • Terms(约定)
      • Simple interface(简单接口)
        • Flex flow
        • Flex align
        • Flex grow
      • Style interface(样式接口)
      • Other features(其它功能)
        • RTL
        • New track(新轨道)
      • Example
      • API
    • Grid(网格布局)
      • Overview(概述)
      • Terms(约定)
      • Simple interface(简单的接口)
        • Grid descriptors
        • Grid items(网格项)
        • Grid align(网格对齐)
      • Style interface(样式接口)
      • Other features (其它功能)
        • RTL
      • Example
      • API
  • 3rd party libraries(第三方库)
    • File System Interfaces(文件系统接口)
      • Usage(用法)
    • BMP decoder(BMP解码器)
      • Limitations(限制条件)
      • Example
      • API
    • JPG decoder(JPG解码器)
      • Overview(概述)
      • Usage(用法)
      • Converter(转换器)
        • Converting JPG to C array(将 JPG 转换为 C 数组)
        • Converting JPG to SJPG(将 JPG 转换为 SJPG)
      • Example(示例)
      • API
    • PNG decoder(PNG解码器)
      • Example(用法)
      • API
    • GIF decoder(GIF解码器)
      • Convert GIF files to C array(将 GIF 文件转换为 C 数组)
      • Use GIF images from file(使用文件中的 GIF 图片)
      • Memory requirements(内存要求)
      • Example(用法)
      • API
    • FreeType support(支持FreeType)
      • Install FreeType(安装 FreeType)
      • Add FreeType to your project(将 FreeType 添加到项目中)
      • Usage(用法)
      • Learn more(深入学习)
      • API
    • QR code(二维码)
      • Get started(开始)
      • Notes(注意)
      • Example(示例)
      • API
    • Lottie player
      • Build Rlottie(构建 Rlottie)
      • Usage(用法)
        • Use Rlottie from file(使用文件中的 Rlottie)
        • Use Rlottie from raw string data(使用原始字符串数据中的 Rlottie)
      • Getting animations(获取动画)
      • Example(示例)
      • API
  • Others(其他)
    • Snapshot(快照)
      • Usage(用法)
        • Free the Image(释放图像)
        • Use Existing Buffer(使用现有缓冲区)
      • Example
      • API
  • Contributing(贡献)
    • Introduction(介绍)
    • Pull request(拉取请求)
      • From GitHub(来自GitHub)
      • From command line(从命令行获取)
      • Commit message format(commit的格式)
    • Developer Certification of Origin (DCO)(开发者原产地认证 (DCO))
      • Overview(概述)
      • Accepted licenses and copyright notices(接受的许可和版权声明)
        • Your own work(你自己的作品)
        • Use code from online source(使用来自网上的代码)
        • Use MIT licensed code(使用 MIT 许可代码)
        • Use GPL licensed code(使用 GPL 许可代码)
    • Ways to contribute(贡献方式)
      • Give LVGL a Star(给 LVGL 一颗星)
      • Tell what you have achieved(讲述你的成就)
      • Write examples(撰写实例)
      • Improve the docs(改进文档)
      • Report bugs(报告bug)
      • Send fixes(提交补丁)
      • Join the conversations in the Forum(参与论坛讨论)
      • Add features(添加功能)
      • Become a maintainer(成为维护者)
      • Move your project repository under LVGL organization(将您的项目库移到LVGL组织下)
  • Changelog(更新日志)
    • v8.1.0 (In progress)(进行中)
    • v8.0.2 (16.07.2021)
    • v8.0.1 (14.06.2021)
    • v8.0.0 (01.06.2021)
      • Directory structure(目录结构)
      • Widget changes(部件更改)
      • New scrolling(新的滚动功能)
      • New layouts(新的布局)
      • Styles(样式)
      • Events(事件)
      • Driver changes(驱动程序更改)
      • Other changes(其他变化)
      • New release policy(新的发布政策)
      • Migrating from v7 to v8(从 v7 迁移到 v8)
    • v7.11.0 (16.03.2021)
      • New features
      • Bugfixes
    • v7.10.1 (16.02.2021)
      • Bugfixes
    • v7.10.0 (02.02.2021)
      • New features
      • Bugfixes
    • v7.9.1 (19.01.2021)
      • Bugfixes
    • v7.9.0 (05.01.2021)
      • New features
      • Bugfixes
    • v7.8.1 (15.12.2020)
      • Bugfixes
    • v7.8.0 (01.12.2020)
      • New features
      • Bugfixes
    • v7.7.2 (17.11.2020)
      • Bugfixes
    • v7.7.1 (03.11.2020)
      • Bugfixes
    • v7.7.0 (20.10.2020)
      • New features
      • Bugfixes
    • v7.6.1 (06.10.2020)
      • Bugfixes
    • v7.6.0 (22.09.2020)
      • New features
      • Bugfixes
    • v7.5.0 (15.09.2020)
      • New features
      • Bugfixes
    • v7.4.0 (01.09.2020)
      • New features
      • Bugfixes
    • v7.3.1 (18.08.2020)
      • Bugfixes
    • v7.3.0 (04.08.2020)
      • New features
      • Bugfixes
    • v7.2.0 (21.07.2020)
      • New features
      • Bugfixes
    • v7.1.0 (07.07.2020)
      • New features
      • Bugfixes
    • v7.0.2 (16.06.2020)
      • Bugfixes
    • v7.0.1 (01.06.2020)
      • Bugfixes
    • v7.0.0 (18.05.2020)
      • Documentation
      • Legal changes
      • New drawing system
      • New style system
      • GPU integration
      • Renames
      • Reworked and improved object
      • New object types
      • Others
      • Demos
      • New release policy
      • Migrating from v6 to v7
  • Roadmap(产品线路)
    • v8.1
      • Features(功能)
        • New features(新功能)
      • Discuss(讨论)
      • Docs(文档)
      • Others(其他)
    • v8.2
    • Ideas(想法)
    • v8
  • 项目实战
    • 在windwos模拟器运行lvgl(v8.0)
      • Code::Blocks上运行
        • 获取资料
        • 获取Code::Blocks并安装
        • 获取示例源码并运行
      • 在 Eclipse 上运行
      • 在 vscode 上运行
    • STM32F103 LVGL GUI DEMO效果
      • STM32F103 LVGL GUI DEMO源码
    • STM32MP157 LVGL GUI DEMO效果
      • STM32MP157 LVGL GUI DEMO源码
    • IMX6ULL LVGL GUI DEMO效果
      • IMX6ULL Linux LVGL GUI V2.0
        • 源码
      • IMX6ULL Linux LVGL GUI 1.0
        • 源码
    • ESP32 LVGL GUI DEMO效果
  • 开发实用工具
    • 显示中文
      • 中文字体文件
        • 思源字体
        • 更多字体
      • 常用汉字
        • 常用495个汉字
        • 常用3500个汉字
      • 字符集编码范围
        • 汉字 Unicode 编码范围
        • 拉丁字母 Unicode 编码范围
        • ASCII码表
      • 字体转换工具
        • lvgl官方在线转换工具
        • 使用教程
    • 让lvgl支持中文输入
      • 源码仓库
  • 联系我们
  • 🔥加入技术交流群聊一起学习!
百问网LVGL中文教程文档
  • »
  • Widgets(部件) »
  • Core widgets(核心部件) »
  • Drop-down list(下拉列表) (lv_dropdown)
  • 在 GitHub 上修改

Drop-down list(下拉列表) (lv_dropdown)¶

Overview(概述)¶

查看原文

The drop-down list allows the user to select one value from a list.

The drop-down list is closed by default and displays a single value or a predefined text. When activated (by click on the drop-down list), a list is created from which the user may select one option. When the user selects a new value, the list is deleted again.

The Drop-down list is added to the default group (if it is set). Besides the Drop-down list is an editable object to allow selecting an option with encoder navigation too.

下拉列表允许用户从列表中选择一个值。

下拉列表默认关闭并显示单个值或预定义文本。 激活后(通过单击下拉列表),将创建一个列表,用户可以从中选择一个选项。 当用户选择一个新值时,该列表将再次被删除。

下拉列表将添加到默认组(如果已设置)。 除了下拉列表是一个可编辑的对象,也允许选择带有编码器导航的选项。

Parts and Styles(部件和样式)¶

查看原文

The Dropdown widget is built from the elements: "button" and "list" (both not related to the button and list widgets)

下拉小部件由以下元素构建:“按钮”和“列表”(均与按钮和列表小部件无关)

Button(按钮)¶

查看原文

  • LV_PART_MAIN The background of the button. Uses the typical background properties and text properties for the text on it.

  • LV_PART_INDICATOR Typically an arrow symbol that can be an image or a text (LV_SYMBOL).

The button goes to LV_STATE_CHECKED when its opened.

  • LV_PART_MAIN 按钮的背景。 对其上的文本使用典型的背景属性和文本属性。

  • LV_PART_INDICATOR 通常是一个箭头符号,可以是图像或文本(LV_SYMBOL)。

按钮在打开时会转到“LV_STATE_CHECKED”。

List(列表)¶

查看原文

  • LV_PART_MAIN The list itself. Uses the typical background properties. max_height can be used to limit the height of the list.

  • LV_PART_SCROLLBAR The scrollbar background, border, shadow properties and width (for its own width) and right padding for the spacing on the right.

  • LV_PART_SELECTED Refers to the currently pressed, checked or pressed+checked option. Also uses the typical background properties.

As list does not exist when the drop-down list is closed it's not possible to simply add styles to it. Instead the following should be done:

  1. Ad an event handler to the button for LV_EVENT_VALUE_CHANGED (triggered when the list is opened/closed)

  2. Use lv_obj_t * list = lv_dropdown_get_list(dropdown)

  3. if(list != NULL) {/*Add the styles to the list*/}

Alternatively the theme can be extended with the new styles.

  • LV_PART_MAIN 列表本身。 使用典型的背景属性。 max_height 可用于限制列表的高度。

  • LV_PART_SCROLLBAR 滚动条背景、边框、阴影属性和宽度(对于它自己的宽度)以及右侧间距的右侧填充。

  • LV_PART_SELECTED 指的是当前按下、选中或按下+选中的选项。 还使用典型的背景属性。

由于下拉列表关闭时列表不存在,因此无法简单地向其添加样式。 相反,应执行以下操作:

  1. 为LV_EVENT_VALUE_CHANGED 的按钮添加一个事件处理程序(在列表打开/关闭时触发) 2.使用lv_obj_t * list = lv_dropdown_get_list(dropdown)

  2. if(list != NULL) {/*将样式添加到列表中*/}

或者,可以使用新样式扩展主题。

Usage(用法)¶

Overview(概述)¶

Set options(设置选项)¶

查看原文

Options are passed to the drop-down list as a string with lv_dropdown_set_options(dropdown, options). Options should be separated by \n. For example: "First\nSecond\nThird". This string will be saved in the drop-down list, so it can in a local variable.

The lv_dropdown_add_option(dropdown, "New option", pos) function inserts a new option to pos index.

To save memory the options can set from a static(constant) string too with lv_dropdown_set_static_options(dropdown, options). In this case the options string should be alive while the drop-down list exists and lv_dropdown_add_option can't be used

You can select an option manually with lv_dropdown_set_selected(dropdown, id), where id is the index of an option.

选项作为带有lv_dropdown_set_options(dropdown, options)的字符串传递给下拉列表。 选项应该用 \n 分隔。 例如:"First\nSecond\nThird"。 该字符串将保存在下拉列表中,因此它可以保存在局部变量中。

lv_dropdown_add_option(dropdown, "New option", pos) 函数向 pos 索引插入一个新选项。

为了节省内存,选项也可以使用lv_dropdown_set_static_options(dropdown, options)从静态(常量)字符串中设置。 在这种情况下,当下拉列表存在且不能使用 lv_dropdown_add_option 时,选项字符串应该是活动的

您可以使用 lv_dropdown_set_selected(dropdown, id) 手动选择一个选项,其中 id 是一个选项的索引。

Get selected option(获取选择的选项)¶

查看原文

The get the index of the selected option, use lv_dropdown_get_selected(dropdown).

lv_dropdown_get_selected_str(dropdown, buf, buf_size) copies the name of the selected option to buf.

获取所选选项的index,使用lv_dropdown_get_selected(dropdown)。

lv_dropdown_get_selected_str(dropdown, buf, buf_size) 将所选选项的 name 复制到 buf。

Direction(方向)¶

查看原文

The list can be created on any side. The default LV_DIR_BOTTOM can be modified by lv_dropdown_set_dir(dropdown, LV_DIR_LEFT/RIGHT/UP/BOTTOM) function.

If the list would be vertically out of the screen, it will be aligned to the edge.

列表可以在任何一侧创建。 默认的LV_DIR_BOTTOM可以通过lv_dropdown_set_dir(dropdown, LV_DIR_LEFT/RIGHT/UP/BOTTOM)函数进行修改。

如果列表垂直于屏幕之外,它将与边缘对齐。

Symbol(符号)¶

查看原文

A symbol (typically an arrow) can be added to the drop down list with lv_dropdown_set_symbol(dropdown, LV_SYMBOL_...)

If the direction of the drop-down list is LV_DIR_LEFT the symbol will be shown on the left, otherwise on the right.

可以使用 lv_dropdown_set_symbol(dropdown, LV_SYMBOL_...) 将符号(通常是箭头)添加到下拉列表中

如果下拉列表的方向是LV_DIR_LEFT,符号将显示在左侧,否则显示在右侧。

Show selected(显示选中)¶

查看原文

The main part can either show the selected option or a static text. If a static is set with lv_dropdown_set_text(dropdown, "Some text") it will be shown regardless to th selected option. If the text is NULL the selected option is displayed on the button.

主要部分可以显示所选选项或静态文本。 如果使用 lv_dropdown_set_text(dropdown, "Some text") 设置静态,无论选择哪个选项,它都会显示。 如果文本为“NULL”,则所选选项将显示在按钮上。

Manually open/close(手动打开/关闭)¶

查看原文

To manually open or close the drop-down list the lv_dropdown_open/close(dropdown) function can be used.

要手动打开或关闭下拉列表,可以使用 lv_dropdown_open/close(dropdown) 函数。

Events(事件)¶

查看原文

Apart from the Generic events, the following Special events are sent by the drop-down list:

  • LV_EVENT_VALUE_CHANGED Sent when the new option is selected or the list is opened/closed.

See the events of the Base object too.

Learn more about Events.

除了通用事件,下拉列表发送以下特殊事件 :

  • LV_EVENT_VALUE_CHANGED 在选择新选项或打开/关闭列表时发送。

参见 Base object 的事件。

详细了解 事件。

Keys(按键)¶

查看原文

  • LV_KEY_RIGHT/DOWN Select the next option.

  • LV_KEY_LEFT/UP Select the previous option.

  • LY_KEY_ENTER Apply the selected option (Sends LV_EVENT_VALUE_CHANGED event and closes the drop-down list).

Learn more about Keys.

  • LV_KEY_RIGHT/DOWN 选择下一个选项。

  • LV_KEY_LEFT/UP 选择上一个选项。

  • LY_KEY_ENTER 应用选择的选项(发送LV_EVENT_VALUE_CHANGED 事件并关闭下拉列表)。

了解有关 Keys 的更多信息。

Example¶

Simple Drop down list¶

C code  

 GitHub
#include "../../lv_examples.h"
#if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES

static void event_handler(lv_event_t * e)
{
    lv_event_code_t code = lv_event_get_code(e);
    lv_obj_t * obj = lv_event_get_target(e);
    if(code == LV_EVENT_VALUE_CHANGED) {
        char buf[32];
        lv_dropdown_get_selected_str(obj, buf, sizeof(buf));
        LV_LOG_USER("Option: %s", buf);
    }
}

void lv_example_dropdown_1(void)
{

    /*Create a normal drop down list*/
    lv_obj_t * dd = lv_dropdown_create(lv_scr_act());
    lv_dropdown_set_options(dd, "Apple\n"
                                "Banana\n"
                                "Orange\n"
                                "Cherry\n"
                                "Grape\n"
                                "Raspberry\n"
                                "Melon\n"
                                "Orange\n"
                                "Lemon\n"
                                "Nuts");

    lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 20);
    lv_obj_add_event_cb(dd, event_handler, LV_EVENT_ALL, NULL);
}

#endif

MicroPython code  

 GitHub Simulator
def event_handler(e):
    code = e.get_code()
    obj = e.get_target()
    if code == lv.EVENT.VALUE_CHANGED: 
        option = " "*10 # should be large enough to store the option
        obj.get_selected_str(option, len(option))
        # .strip() removes trailing spaces
        print("Option: \"%s\"" % option.strip())

# Create a normal drop down list
dd = lv.dropdown(lv.scr_act())
dd.set_options("\n".join([
    "Apple",
    "Banana",
    "Orange",
    "Cherry",
    "Grape",
    "Raspberry",
    "Melon",
    "Orange",
    "Lemon",
    "Nuts"]))

dd.align(lv.ALIGN.TOP_MID, 0, 20)
dd.add_event_cb(event_handler, lv.EVENT.ALL, None)


Drop down in four directions¶

C code  

 GitHub
#include "../../lv_examples.h"
#if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES


/**
 * Create a drop down, up, left and right menus
 */
void lv_example_dropdown_2(void)
{
    static const char * opts = "Apple\n"
                               "Banana\n"
                               "Orange\n"
                               "Melon";

    lv_obj_t * dd;
    dd = lv_dropdown_create(lv_scr_act());
    lv_dropdown_set_options_static(dd, opts);
    lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 10);

    dd = lv_dropdown_create(lv_scr_act());
    lv_dropdown_set_options_static(dd, opts);
    lv_dropdown_set_dir(dd, LV_DIR_BOTTOM);
    lv_dropdown_set_symbol(dd, LV_SYMBOL_UP);
    lv_obj_align(dd, LV_ALIGN_BOTTOM_MID, 0, -10);

    dd = lv_dropdown_create(lv_scr_act());
    lv_dropdown_set_options_static(dd, opts);
    lv_dropdown_set_dir(dd, LV_DIR_RIGHT);
    lv_dropdown_set_symbol(dd, LV_SYMBOL_RIGHT);
    lv_obj_align(dd, LV_ALIGN_LEFT_MID, 10, 0);

    dd = lv_dropdown_create(lv_scr_act());
    lv_dropdown_set_options_static(dd, opts);
    lv_dropdown_set_dir(dd, LV_DIR_LEFT);
    lv_dropdown_set_symbol(dd, LV_SYMBOL_LEFT);
    lv_obj_align(dd, LV_ALIGN_RIGHT_MID, -10, 0);
}

#endif

MicroPython code  

 GitHub Simulator
#
# Create a drop down, up, left and right menus
#

opts = "\n".join([
    "Apple",
    "Banana",
    "Orange",
    "Melon",
    "Grape",
    "Raspberry"])

dd = lv.dropdown(lv.scr_act())
dd.set_options_static(opts)
dd.align(lv.ALIGN.TOP_MID, 0, 10)
dd = lv.dropdown(lv.scr_act())
dd.set_options_static(opts)
dd.set_dir(lv.DIR.BOTTOM)
dd.set_symbol(lv.SYMBOL.UP)
dd.align(lv.ALIGN.BOTTOM_MID, 0, -10)

dd = lv.dropdown(lv.scr_act())
dd.set_options_static(opts)
dd.set_dir(lv.DIR.RIGHT)
dd.set_symbol(lv.SYMBOL.RIGHT)
dd.align(lv.ALIGN.LEFT_MID, 10, 0)

dd = lv.dropdown(lv.scr_act())
dd.set_options_static(opts)
dd.set_dir(lv.DIR.LEFT)
dd.set_symbol(lv.SYMBOL.LEFT)
dd.align(lv.ALIGN.RIGHT_MID, -10, 0)



Menu¶

C code  

 GitHub
#include "../../lv_examples.h"
#if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES

static void event_cb(lv_event_t * e)
{
    lv_obj_t * dropdown = lv_event_get_target(e);
    char buf[64];
    lv_dropdown_get_selected_str(dropdown, buf, sizeof(buf));
    LV_LOG_USER("'%s' is selected", buf);
}

/**
 * Create a menu from a drop-down list and show some drop-down list features and styling
 */
void lv_example_dropdown_3(void)
{
    /*Create a drop down list*/
    lv_obj_t * dropdown = lv_dropdown_create(lv_scr_act());
    lv_obj_align(dropdown, LV_ALIGN_TOP_LEFT, 10, 10);
    lv_dropdown_set_options(dropdown, "New project\n"
                                      "New file\n"
                                      "Save\n"
                                      "Save as ...\n"
                                      "Open project\n"
                                      "Recent projects\n"
                                      "Preferences\n"
                                      "Exit");

    /*Set a fixed text to display on the button of the drop-down list*/
    lv_dropdown_set_text(dropdown, "Menu");

    /*Use a custom image as down icon and flip it when the list is opened*/
    LV_IMG_DECLARE(img_caret_down)
    lv_dropdown_set_symbol(dropdown, &img_caret_down);
    lv_obj_set_style_transform_angle(dropdown, 1800, LV_PART_INDICATOR | LV_STATE_CHECKED);

    /*In a menu we don't need to show the last clicked item*/
    lv_dropdown_set_selected_highlight(dropdown, false);

    lv_obj_add_event_cb(dropdown, event_cb, LV_EVENT_VALUE_CHANGED, NULL);
}

#endif

MicroPython code  

 GitHub Simulator
from imagetools import get_png_info, open_png

# Register PNG image decoder
decoder = lv.img.decoder_create()
decoder.info_cb = get_png_info
decoder.open_cb = open_png

# Create an image from the png file
try:
    with open('../../assets/img_caret_down.png','rb') as f:
        png_data = f.read()
except:
    print("Could not find img_caret_down.png")
    sys.exit()
    
img_caret_down_argb = lv.img_dsc_t({
  'data_size': len(png_data),
  'data': png_data 
})

def event_cb(e):
    dropdown = e.get_target()
    option = " "*64 # should be large enough to store the option
    dropdown.get_selected_str(option, len(option))
    print(option.strip() +" is selected")
#
# Create a menu from a drop-down list and show some drop-down list features and styling
#

# Create a drop down list
dropdown = lv.dropdown(lv.scr_act())
dropdown.align(lv.ALIGN.TOP_LEFT, 10, 10)
dropdown.set_options("\n".join([
    "New project",
    "New file",
    "Open project",
    "Recent projects",
    "Preferences",
    "Exit"]))

# Set a fixed text to display on the button of the drop-down list
dropdown.set_text("Menu")

# Use a custom image as down icon and flip it when the list is opened
# LV_IMG_DECLARE(img_caret_down)
dropdown.set_symbol(img_caret_down_argb)
dropdown.set_style_transform_angle(1800, lv.PART.INDICATOR | lv.STATE.CHECKED)

# In a menu we don't need to show the last clicked item
dropdown.set_selected_highlight(False)

dropdown.add_event_cb(event_cb, lv.EVENT.VALUE_CHANGED, None)


API¶

Functions

LV_EXPORT_CONST_INT(LV_DROPDOWN_POS_LAST)¶
lv_obj_t *lv_dropdown_create(lv_obj_t *parent)¶

Create a drop-down list objects

参数

parent -- pointer to an object, it will be the parent of the new drop-down list

返回

pointer to the created drop-down list

void lv_dropdown_set_text(lv_obj_t *obj, const char *txt)¶

Set text of the drop-down list's button. If set to NULL the selected option's text will be displayed on the button. If set to a specific text then that text will be shown regardless the selected option.

参数
  • obj -- pointer to a drop-down list object

  • txt -- the text as a string (Only its pointer is saved)

void lv_dropdown_set_options(lv_obj_t *obj, const char *options)¶

Set the options in a drop-down list from a string. The options will be copied and saved in the object so the options can be destroyed after calling this function

参数
  • obj -- pointer to drop-down list object

  • options --

    a string with '

    ' separated options. E.g. "One\nTwo\nThree"

void lv_dropdown_set_options_static(lv_obj_t *obj, const char *options)¶

Set the options in a drop-down list from a static string (global, static or dynamically allocated). Only the pointer of the option string will be saved.

参数
  • obj -- pointer to drop-down list object

  • options --

    a static string with '

    ' separated options. E.g. "One\nTwo\nThree"

void lv_dropdown_add_option(lv_obj_t *obj, const char *option, uint32_t pos)¶

Add an options to a drop-down list from a string. Only works for non-static options.

参数
  • obj -- pointer to drop-down list object

  • option --

    a string without '

    '. E.g. "Four"

  • pos -- the insert position, indexed from 0, LV_DROPDOWN_POS_LAST = end of string

void lv_dropdown_clear_options(lv_obj_t *obj)¶

Clear all options in a drop-down list. Works with both static and dynamic optins.

参数

obj -- pointer to drop-down list object

void lv_dropdown_set_selected(lv_obj_t *obj, uint16_t sel_opt)¶

Set the selected option

参数
  • obj -- pointer to drop-down list object

  • sel_opt -- id of the selected option (0 ... number of option - 1);

void lv_dropdown_set_dir(lv_obj_t *obj, lv_dir_t dir)¶

Set the direction of the a drop-down list

参数
  • obj -- pointer to a drop-down list object

  • dir -- LV_DIR_LEFT/RIGHT/TOP/BOTTOM

void lv_dropdown_set_symbol(lv_obj_t *obj, const void *symbol)¶

Set an arrow or other symbol to display when on drop-down list's button. Typically a down caret or arrow.

注解

angle and zoom transformation can be applied if the symbol is an image. E.g. when drop down is checked (opened) rotate the symbol by 180 degree

参数
  • obj -- pointer to drop-down list object

  • symbol -- a text like LV_SYMBOL_DOWN, an image (pointer or path) or NULL to not draw symbol icon

void lv_dropdown_set_selected_highlight(lv_obj_t *obj, bool en)¶

Set whether the selected option in the list should be highlighted or not

参数
  • obj -- pointer to drop-down list object

  • en -- true: highlight enabled; false: disabled

lv_obj_t *lv_dropdown_get_list(lv_obj_t *obj)¶

Get the list of a drop-down to allow styling or other modifications

参数

obj -- pointer to a drop-down list object

返回

pointer to the list of the drop-down

const char *lv_dropdown_get_text(lv_obj_t *obj)¶

Get text of the drop-down list's button.

参数

obj -- pointer to a drop-down list object

返回

the text as string, NULL if no text

const char *lv_dropdown_get_options(const lv_obj_t *obj)¶

Get the options of a drop-down list

参数

obj -- pointer to drop-down list object

返回

the options separated by '

'-s (E.g. "Option1\nOption2\nOption3")

uint16_t lv_dropdown_get_selected(const lv_obj_t *obj)¶

Get the index of the selected option

参数

obj -- pointer to drop-down list object

返回

index of the selected option (0 ... number of option - 1);

uint16_t lv_dropdown_get_option_cnt(const lv_obj_t *obj)¶

Get the total number of options

参数

obj -- pointer to drop-down list object

返回

the total number of options in the list

void lv_dropdown_get_selected_str(const lv_obj_t *obj, char *buf, uint32_t buf_size)¶

Get the current selected option as a string

参数
  • obj -- pointer to drop-down object

  • buf -- pointer to an array to store the string

  • buf_size -- size of buf in bytes. 0: to ignore it.

const char *lv_dropdown_get_symbol(lv_obj_t *obj)¶

Get the symbol on the drop-down list. Typically a down caret or arrow.

参数

obj -- pointer to drop-down list object

返回

the symbol or NULL if not enabled

bool lv_dropdown_get_selected_highlight(lv_obj_t *obj)¶

Get whether the selected option in the list should be highlighted or not

参数

obj -- pointer to drop-down list object

返回

true: highlight enabled; false: disabled

lv_dir_t lv_dropdown_get_dir(const lv_obj_t *obj)¶

Get the direction of the drop-down list

参数

obj -- pointer to a drop-down list object

返回

LV_DIR_LEF/RIGHT/TOP/BOTTOM

void lv_dropdown_open(lv_obj_t *dropdown_obj)¶

Open the drop.down list

参数

obj -- pointer to drop-down list object

void lv_dropdown_close(lv_obj_t *obj)¶

Close (Collapse) the drop-down list

参数

obj -- pointer to drop-down list object

Variables

const lv_obj_class_t lv_dropdown_class¶
const lv_obj_class_t lv_dropdownlist_class¶
struct lv_dropdown_t¶

Public Members

lv_obj_t obj¶
lv_obj_t *list¶

The dropped down list

const char *text¶

Text to display on the dropdown's button

const void *symbol¶

Arrow or other icon when the drop-down list is closed

char *options¶

Options in a a '

' separated list

uint16_t option_cnt¶

Number of options

uint16_t sel_opt_id¶

Index of the currently selected option

uint16_t sel_opt_id_orig¶

Store the original index on focus

uint16_t pr_opt_id¶

Index of the currently pressed option

lv_dir_t dir¶

Direction in which the list should open

uint8_t static_txt¶

1: Only a pointer is saved in options

uint8_t selected_highlight¶

1: Make the selected option highlighted in the list

struct lv_dropdown_list_t¶

Public Members

lv_obj_t obj¶
lv_obj_t *dropdown¶
下一页 上一页

© 版权所有 2008-2021 深圳百问网科技有限公司 All Rights Reserved. 最后更新于 2024 年 05 月 17 日.

利用 Sphinx 构建,使用了 主题 由 Read the Docs开发.