1 #include "../../lv_examples.h"
2 #if LV_USE_TABVIEW && LV_BUILD_EXAMPLES
3
lv_example_tabview_2(void)4 void lv_example_tabview_2(void)
5 {
6 /*Create a Tab view object*/
7 lv_obj_t * tabview;
8 tabview = lv_tabview_create(lv_scr_act(), LV_DIR_LEFT, 80);
9
10 lv_obj_set_style_bg_color(tabview, lv_palette_lighten(LV_PALETTE_RED, 2), 0);
11
12 lv_obj_t * tab_btns = lv_tabview_get_tab_btns(tabview);
13 lv_obj_set_style_bg_color(tab_btns, lv_palette_darken(LV_PALETTE_GREY, 3), 0);
14 lv_obj_set_style_text_color(tab_btns, lv_palette_lighten(LV_PALETTE_GREY, 5), 0);
15 lv_obj_set_style_border_side(tab_btns, LV_BORDER_SIDE_RIGHT, LV_PART_ITEMS | LV_STATE_CHECKED);
16
17 /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/
18 lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
19 lv_obj_t * tab2 = lv_tabview_add_tab(tabview, "Tab 2");
20 lv_obj_t * tab3 = lv_tabview_add_tab(tabview, "Tab 3");
21 lv_obj_t * tab4 = lv_tabview_add_tab(tabview, "Tab 4");
22 lv_obj_t * tab5 = lv_tabview_add_tab(tabview, "Tab 5");
23
24 lv_obj_set_style_bg_color(tab2, lv_palette_lighten(LV_PALETTE_AMBER, 3), 0);
25 lv_obj_set_style_bg_opa(tab2, LV_OPA_COVER, 0);
26
27 /*Add content to the tabs*/
28 lv_obj_t * label = lv_label_create(tab1);
29 lv_label_set_text(label, "First tab");
30
31 label = lv_label_create(tab2);
32 lv_label_set_text(label, "Second tab");
33
34 label = lv_label_create(tab3);
35 lv_label_set_text(label, "Third tab");
36
37 label = lv_label_create(tab4);
38 lv_label_set_text(label, "Forth tab");
39
40 label = lv_label_create(tab5);
41 lv_label_set_text(label, "Fifth tab");
42
43 lv_obj_clear_flag(lv_tabview_get_content(tabview), LV_OBJ_FLAG_SCROLLABLE);
44 }
45 #endif
46