当前位置:网站首页>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
边栏推荐
- 潘多拉 IOT 开发板学习(RT-Thread)—— 实验3 按键实验(学习笔记)
- No servers available for service: xxxx
- Data Lake (13): spark and iceberg integrate DDL operations
- 關於miui12.5 紅米k20pro用au或者povo2出現問題的解决辦法
- Compile oglpg-9th-edition source code with clion
- Digi重启XBee-Pro S2C生产,有些差别需要注意
- Gin integrated Alipay payment
- Use of arouter
- C # WPF realizes the real-time screen capture function of screen capture box
- First experience of ViewModel
猜你喜欢
[MySQL from introduction to proficiency] [advanced chapter] (IV) MySQL permission management and control
An overview of 2D human posture estimation
潘多拉 IOT 开发板学习(RT-Thread)—— 实验3 按键实验(学习笔记)
nowcoder重排链表
flink sql-client.sh 使用教程
【MySQL从入门到精通】【高级篇】(五)MySQL的SQL语句执行流程
统计php程序运行时间及设置PHP最长运行时间
实时数据仓库
Digi restarts XBee Pro S2C production. Some differences need to be noted
Talk about 10 tips to ensure thread safety
随机推荐
LVGL 8.2 Draw label with gradient color
使用CLion编译OGLPG-9th-Edition源码
R language ggplot2 visualization: gganimate package creates animated graph (GIF) and uses anim_ The save function saves the GIF visual animation
Detailed explanation of visual studio debugging methods
leetcode:6109. Number of people who know the secret [definition of DP]
MySQL的触发器
第十七章 进程内存
基于51单片机的超声波测距仪
ML之shap:基于boston波士顿房价回归预测数据集利用Shap值对LiR线性回归模型实现可解释性案例
Excel quickly merges multiple rows of data
RK1126平台OSD的实现支持颜色半透明度多通道支持中文
Stm32f1 and stm32subeide programming example -max7219 drives 8-bit 7-segment nixie tube (based on GPIO)
Leetcode T47: 全排列II
Talk about 10 tips to ensure thread safety
LifeCycle
R language ggplot2 visualization: gganimate package creates dynamic line graph animation (GIF) and uses transition_ The reveal function displays data step by step along a given dimension in the animat
Some problems and ideas of data embedding point
LVLG 8.2 circular scrolling animation of a label
Combined with case: the usage of the lowest API (processfunction) in Flink framework
Oppo find N2 product form first exposure: supplement all short boards