当前位置:网站首页>LVGL 8.2 Menu
LVGL 8.2 Menu
2022-07-04 14:35:00 【Fairy sword love】
Simple Menu
static void lv_example_menu_1(void)
{
/*Create a menu object*/
lv_obj_t* menu = lv_menu_create(lv_scr_act()); // Create menu object
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL));// Set size
lv_obj_center(menu); // centered
lv_obj_t* cont;
lv_obj_t* label;
/*Create a sub page*/
lv_obj_t* sub_page = lv_menu_page_create(menu, NULL); // Create menu subpage sub_page
cont = lv_menu_cont_create(sub_page); // stay sub_page Create on object cont Containers
label = lv_label_create(cont); // stay cont To create a Label
lv_label_set_text(label, "Hello, I am hiding here"); // Set display content
/*Create a main page*/
lv_obj_t* main_page = lv_menu_page_create(menu, NULL); // Create menu subpage main_page
cont = lv_menu_cont_create(main_page); // stay main_page Create on object cont Containers
label = lv_label_create(cont); // stay cont To create a Label
lv_label_set_text(label, "Item 1"); // Set display content Item 1
cont = lv_menu_cont_create(main_page); // stay main_page Create on object cont Containers
label = lv_label_create(cont); // stay cont To create a Label
lv_label_set_text(label, "Item 2"); // Set display content Item 2
cont = lv_menu_cont_create(main_page); // stay main_page Create on object cont Containers
label = lv_label_create(cont); // stay cont To create a Label
lv_label_set_text(label, "Item 3 (Click me!)"); // Set display content Item 3 (Click me!)
lv_menu_set_load_page_event(menu, cont, sub_page);// The Settings menu menu in cont The container is clicked and jumps to sub_page
lv_menu_set_page(menu, main_page);// Set up main_page For the current menu Display page for
}
Running effect

item1 and item2 Add jump page
static void lv_example_menu_1(void)
{
/*Create a menu object*/
lv_obj_t* menu = lv_menu_create(lv_scr_act());
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL));
lv_obj_center(menu);
lv_obj_t* cont;
lv_obj_t* label;
/*Create a sub page*/
lv_obj_t* sub_page = lv_menu_page_create(menu, NULL);
cont = lv_menu_cont_create(sub_page);
label = lv_label_create(cont);
lv_label_set_text(label, "Hello, I am hiding here");
lv_obj_t* sub_page1 = lv_menu_page_create(menu, NULL);
cont = lv_menu_cont_create(sub_page1);
label = lv_label_create(cont);
lv_label_set_text(label, "Hello, I am a sub_page1");
lv_obj_t* sub_page2 = lv_menu_page_create(menu, NULL);
cont = lv_menu_cont_create(sub_page2);
label = lv_label_create(cont);
lv_label_set_text(label, "Hello, I am a sub_page2");
/*Create a main page*/
lv_obj_t* main_page = lv_menu_page_create(menu, NULL);
cont = lv_menu_cont_create(main_page);
label = lv_label_create(cont);
lv_label_set_text(label, "Item 1");
lv_menu_set_load_page_event(menu, cont, sub_page1);
cont = lv_menu_cont_create(main_page);
label = lv_label_create(cont);
lv_label_set_text(label, "Item 2");
lv_menu_set_load_page_event(menu, cont, sub_page2);
cont = lv_menu_cont_create(main_page);
label = lv_label_create(cont);
lv_label_set_text(label, "Item 3 (Click me!)");
lv_menu_set_load_page_event(menu, cont, sub_page);
lv_menu_set_page(menu, main_page);
}
Running effect

边栏推荐
- flink sql-client.sh 使用教程
- 第十七章 进程内存
- R language uses dplyr package group_ The by function and the summarize function calculate the mean and standard deviation of the target variables based on the grouped variables
- ML之shap:基于boston波士顿房价回归预测数据集利用Shap值对LiR线性回归模型实现可解释性案例
- (1) The standard of performance tuning and the correct posture for tuning - if you have performance problems, go to the heapdump performance community!
- LVLG 8.2 circular scrolling animation of a label
- leetcode:6110. 网格图中递增路径的数目【dfs + cache】
- A collection of classic papers on convolutional neural networks (deep learning classification)
- (1)性能调优的标准和做好调优的正确姿势-有性能问题,上HeapDump性能社区!
- [information retrieval] experiment of classification and clustering
猜你喜欢

C # WPF realizes the real-time screen capture function of screen capture box

Gin integrated Alipay payment

Docker compose public network deployment redis sentinel mode

潘多拉 IOT 开发板学习(RT-Thread)—— 实验3 按键实验(学习笔记)

一文概览2D人体姿态估计

codeforce:C. Sum of Substrings【边界处理 + 贡献思维 + 灵光一现】

flink sql-client. SH tutorial

SqlServer函数,存储过程的创建和使用

Ultrasonic distance meter based on 51 single chip microcomputer

LVGL 8.2 LED
随机推荐
Pandora IOT development board learning (RT thread) - Experiment 3 button experiment (learning notes)
[MySQL from introduction to proficiency] [advanced chapter] (IV) MySQL permission management and control
Industrial Internet has greater development potential and more industry scenarios
Scratch Castle Adventure Electronic Society graphical programming scratch grade examination level 3 true questions and answers analysis June 2022
实战解惑 | OpenCV中如何提取不规则ROI区域
opencv3.2 和opencv2.4安装
Nowcoder rearrange linked list
leetcode:6109. Number of people who know the secret [definition of DP]
[cloud native] how can I compete with this database?
Programmer turns direction
Visual Studio调试方式详解
Leetcode 61: 旋转链表
关于miui12.5 红米k20pro用au或者povo2出现问题的解决办法
Some problems and ideas of data embedding point
R language uses follow up of epidisplay package The plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses stress The col parameter specifies the
Classify boost libraries by function
Leetcode t49: grouping of alphabetic words
Query optimizer for SQL optimization
Explain of SQL optimization
LVGL 8.2 Sorting a List using up and down buttons