当前位置:网站首页>LVGL 8.2 Tabview
LVGL 8.2 Tabview
2022-07-25 04:17:00 【Fairy sword love】
Simple Tabview
static void lv_example_tabview_1(void)
{
/*Create a Tab view object*/
lv_obj_t* tabview;
tabview = lv_tabview_create(lv_scr_act(), LV_DIR_TOP, 50);
/*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/
lv_obj_t* tab1 = lv_tabview_add_tab(tabview, "Tab 1");
lv_obj_t* tab2 = lv_tabview_add_tab(tabview, "Tab 2");
lv_obj_t* tab3 = lv_tabview_add_tab(tabview, "Tab 3");
/*Add content to the tabs*/
lv_obj_t* label = lv_label_create(tab1);
lv_label_set_text(label, "This the first tab\n\n"
"If the content\n"
"of a tab\n"
"becomes too\n"
"longer\n"
"than the\n"
"container\n"
"then it\n"
"automatically\n"
"becomes\n"
"scrollable.\n"
"\n"
"\n"
"\n"
"Can you see it?");
label = lv_label_create(tab2);
lv_label_set_text(label, "Second tab");
label = lv_label_create(tab3);
lv_label_set_text(label, "Third tab");
lv_obj_scroll_to_view_recursive(label, LV_ANIM_ON);
}
- Running effect

Tabs on the left, styling and no scrolling
static void scroll_begin_event(lv_event_t* e)
{
/*Disable the scroll animations. Triggered when a tab button is clicked */
if (lv_event_get_code(e) == LV_EVENT_SCROLL_BEGIN) {
lv_anim_t* a = lv_event_get_param(e);
if (a) a->time = 0;
}
}
static void lv_example_tabview_2(void)
{
/*Create a Tab view object*/
lv_obj_t* tabview;
tabview = lv_tabview_create(lv_scr_act(), LV_DIR_LEFT, 80);
lv_obj_add_event_cb(lv_tabview_get_content(tabview), scroll_begin_event, LV_EVENT_SCROLL_BEGIN, NULL);
lv_obj_set_style_bg_color(tabview, lv_palette_lighten(LV_PALETTE_RED, 2), 0);
lv_obj_t* tab_btns = lv_tabview_get_tab_btns(tabview);
lv_obj_set_style_bg_color(tab_btns, lv_palette_darken(LV_PALETTE_GREY, 3), 0);
lv_obj_set_style_text_color(tab_btns, lv_palette_lighten(LV_PALETTE_GREY, 5), 0);
lv_obj_set_style_border_side(tab_btns, LV_BORDER_SIDE_RIGHT, LV_PART_ITEMS | LV_STATE_CHECKED);
/*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/
lv_obj_t* tab1 = lv_tabview_add_tab(tabview, "Tab 1");
lv_obj_t* tab2 = lv_tabview_add_tab(tabview, "Tab 2");
lv_obj_t* tab3 = lv_tabview_add_tab(tabview, "Tab 3");
lv_obj_t* tab4 = lv_tabview_add_tab(tabview, "Tab 4");
lv_obj_t* tab5 = lv_tabview_add_tab(tabview, "Tab 5");
lv_obj_set_style_bg_color(tab2, lv_palette_lighten(LV_PALETTE_AMBER, 3), 0);
lv_obj_set_style_bg_opa(tab2, LV_OPA_COVER, 0);
/*Add content to the tabs*/
lv_obj_t* label = lv_label_create(tab1);
lv_label_set_text(label, "First tab");
label = lv_label_create(tab2);
lv_label_set_text(label, "Second tab");
label = lv_label_create(tab3);
lv_label_set_text(label, "Third tab");
label = lv_label_create(tab4);
lv_label_set_text(label, "Forth tab");
label = lv_label_create(tab5);
lv_label_set_text(label, "Fifth tab");
lv_obj_clear_flag(lv_tabview_get_content(tabview), LV_OBJ_FLAG_SCROLLABLE);
}
- Running effect

边栏推荐
- Eve-ng lab simulator Cisco, H3C test host alias
- Implementation of some basic operation codes of string
- Fifth day of force deduction
- Shell string
- What tools are available to connect and manage polardb for PostgreSQL databases?
- Yuntu says digital asset chain: your God of digital asset property protection
- Huawei od maximum consumption JS
- One question per day
- SQL comment
- How should enterprise users choose aiops or APM?
猜你喜欢

Installation and tutorial of MATLAB curling simulation game

Cluster clock synchronization configuration

DNS domain name resolution

Day008 select structure (switch statement)

Creativity: presentation of AI oil paintings with high imitation mineral pigments

Wechat applet access wechat payment process

Penetration test target combat SQL injection getshell

Yuntu says digital asset chain: your God of digital asset property protection

ES (8.1) certification topic

Permanently solve Matplotlib Chinese garbled code
随机推荐
Display: the function and effect of align content, justify content and align items under flex
基于ABP实现DDD--领域逻辑和应用逻辑
Divide candy Huawei od JS
Do you really understand images? (machine vision)
Openharmony Mengxin contribution Guide
Permanently solve Matplotlib Chinese garbled code
Typical data Lake application cases
Emergency response stack
[understanding of opportunity-47]: Guiguzi - Chapter 11 - decision makers, moderation, and rational distribution of interests
原创 | ueditor1.4.3-asmx绕过waf
有个问题想请教下,我想用来同步数据库,但我看他是根据mysql 的binlog同步的,如果是大表,一
(cvpr2020) reading of learning texture transformer network for image super resolution
考研经历
MySQL select query part 2
An article takes you quickly to learn flex layout
Analytic hierarchy process of MATLAB
51 single chip microcomputer measures the period of square wave signal
JS absolute minimum value of the sum of Huawei od two numbers
Digital collections can go further without hype
Win11 experience