当前位置:网站首页>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

边栏推荐
- Programmer turns direction
- 流行框架:Glide的使用
- leetcode:6110. 网格图中递增路径的数目【dfs + cache】
- opencv3.2 和opencv2.4安装
- 软件测试之测试评估
- Popular framework: the use of glide
- (1)性能调优的标准和做好调优的正确姿势-有性能问题,上HeapDump性能社区!
- 实时数据仓库
- 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
- PyTorch的自动求导机制详细解析,PyTorch的核心魔法
猜你喜欢
![leetcode:6109. Number of people who know the secret [definition of DP]](/img/95/03e2606b249f26db052cf5075041c1.png)
leetcode:6109. Number of people who know the secret [definition of DP]

统计php程序运行时间及设置PHP最长运行时间

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

Nowcoder rearrange linked list

Scratch Castle Adventure Electronic Society graphical programming scratch grade examination level 3 true questions and answers analysis June 2022

Data center concept

flink sql-client.sh 使用教程

(1) The standard of performance tuning and the correct posture for tuning - if you have performance problems, go to the heapdump performance community!

Leetcode 61: 旋转链表

Compile oglpg-9th-edition source code with clion
随机推荐
LVGL 8.2 keyboard
Combined with case: the usage of the lowest API (processfunction) in Flink framework
Redis daily notes
Detailed index of MySQL
LiveData
Talk about 10 tips to ensure thread safety
一种架构来完成所有任务—Transformer架构正在以一己之力统一AI江湖
Classify boost libraries by function
利用Shap值进行异常值检测
Abnormal value detection using shap value
深度学习7 Transformer系列实例分割Mask2Former
Leetcode 61: rotating linked list
Popular framework: the use of glide
92. (cesium chapter) cesium building layering
Data Lake (13): spark and iceberg integrate DDL operations
flink sql-client. SH tutorial
软件测试之测试评估
【算法leetcode】面试题 04.03. 特定深度节点链表(多语言实现)
【MySQL从入门到精通】【高级篇】(四)MySQL权限管理与控制
關於miui12.5 紅米k20pro用au或者povo2出現問題的解决辦法