当前位置:网站首页>LVGL 8.2 Tabview & Window
LVGL 8.2 Tabview & Window
2022-07-19 19:53:00 【仙剑情缘】
Tileview with content
static void lv_example_tileview_1(void)
{
lv_obj_t* tv = lv_tileview_create(lv_scr_act());
/*Tile1: just a label*/
lv_obj_t* tile1 = lv_tileview_add_tile(tv, 0, 0, LV_DIR_BOTTOM);
lv_obj_t* label = lv_label_create(tile1);
lv_label_set_text(label, "Scroll down");
lv_obj_center(label);
/*Tile2: a button*/
lv_obj_t* tile2 = lv_tileview_add_tile(tv, 0, 1, LV_DIR_TOP | LV_DIR_RIGHT);
lv_obj_t* btn = lv_btn_create(tile2);
label = lv_label_create(btn);
lv_label_set_text(label, "Scroll up or right");
lv_obj_set_size(btn, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_center(btn);
/*Tile3: a list*/
lv_obj_t* tile3 = lv_tileview_add_tile(tv, 1, 1, LV_DIR_LEFT);
lv_obj_t* list = lv_list_create(tile3);
lv_obj_set_size(list, LV_PCT(100), LV_PCT(100));
lv_list_add_btn(list, NULL, "One");
lv_list_add_btn(list, NULL, "Two");
lv_list_add_btn(list, NULL, "Three");
lv_list_add_btn(list, NULL, "Four");
lv_list_add_btn(list, NULL, "Five");
lv_list_add_btn(list, NULL, "Six");
lv_list_add_btn(list, NULL, "Seven");
lv_list_add_btn(list, NULL, "Eight");
lv_list_add_btn(list, NULL, "Nine");
lv_list_add_btn(list, NULL, "Ten");
}
- 运行效果
Simple window
static void event_handler(lv_event_t* e)
{
lv_obj_t* obj = lv_event_get_target(e);
LV_LOG_USER("Button %d clicked", (int)lv_obj_get_index(obj));
}
static void lv_example_win_1(void)
{
lv_obj_t* win = lv_win_create(lv_scr_act(), 40);
lv_obj_t* btn;
btn = lv_win_add_btn(win, LV_SYMBOL_LEFT, 40);
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
lv_win_add_title(win, "A title");
btn = lv_win_add_btn(win, LV_SYMBOL_RIGHT, 40);
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
btn = lv_win_add_btn(win, LV_SYMBOL_CLOSE, 60);
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
lv_obj_t* cont = lv_win_get_content(win); /*Content can be added here*/
lv_obj_t* label = lv_label_create(cont);
lv_label_set_text(label, "This is\n"
"a pretty\n"
"long text\n"
"to see how\n"
"the window\n"
"becomes\n"
"scrollable.\n"
"\n"
"\n"
"Some more\n"
"text to be\n"
"sure it\n"
"overflows. :)");
}
- 运行效果
边栏推荐
- 对Coinbase中长期前景的冷静评估
- 如何在微信小游戏制作工具中实现递归函数
- Redis 实战篇:巧用 Bitmap 实现亿级海量数据统计
- Redis core: the only secret that cannot be broken quickly
- About bug
- 67亿美元!瑞萨电子收购IDT获得最终审批通过!
- 生成器的使用原则及方法以及利用生成器实现简易项目(内含详细解说传参问题)
- What is the function of dbc2000? Installation and configuration of dbc2000
- 【开发教程5】疯壳·ARM功能手机-串口实验教程
- Skynet天网监测到的数笔可疑交易背后:又一欺诈项目Forest Tiger Pro被确认
猜你喜欢
Depth traversal: count the number of nodes with the highest score
Face contour image extraction in online conference (III) -- feature extraction of face contour image in Dlib database
How to install the blue bookmark plug-in in the secure browser?
服务器带宽和家用宽带的区别?
How to meet the security needs of various cloud environments in the era of digital economy?
Embedded sharing collection 16
Overview | comprehensive comparative research on image denoising
Redis core: the only secret that cannot be broken quickly
Redis high availability: you call this sentinel sentinel cluster principle
数据分布优化:如何应对数据倾斜?
随机推荐
Introduction to the swap function of Quanzhi v853 chip and the use method of swap partition on Tina
【云图说】第248期 图解公网域名解析:轻松实现域名访问网站/邮箱
Redis high availability: you call this sentinel sentinel cluster principle
吉利和戴姆勒成立合资公司,将再国内生产纯电动smart!
短視頻系統源碼,uni-app項目中主要文件的加載順序
About bug
OpenCV4.5.x+CUDA11.0.x源码编译与YOLOv5加速教程!
finance × Yuancosmos: financial system under the integration of reality and emptiness
Redis 很屌,不懂使用规范就糟蹋了
Babang MS Marco! Transformer based hybrid list aware sorting model
[untitled]
leetcode 面试题 05.06. 整数转换
What is the difference between server bandwidth and home broadband?
Ajout, suppression, modification et exception de cookies
Firewall related
一张图看懂华为2018年财报
对Coinbase中长期前景的冷静评估
Redis log: the killer mace of rapid recovery without fear of downtime
【历史上的今天】7 月 19 日:IMAP 协议之父出生;Project Kotlin 公开亮相;CT 成像实现新突破
Arrays.sort()自定义比较函数