1 #include "../../lv_examples.h"
2 #if LV_USE_TABVIEW && LV_BUILD_EXAMPLES
3 
lv_example_tabview_1(void)4 void lv_example_tabview_1(void)
5 {
6     /*Create a Tab view object*/
7     lv_obj_t * tabview;
8     tabview = lv_tabview_create(lv_scr_act(), LV_DIR_TOP, 50);
9 
10     /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/
11     lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
12     lv_obj_t * tab2 = lv_tabview_add_tab(tabview, "Tab 2");
13     lv_obj_t * tab3 = lv_tabview_add_tab(tabview, "Tab 3");
14 
15     /*Add content to the tabs*/
16     lv_obj_t * label = lv_label_create(tab1);
17     lv_label_set_text(label, "This the first tab\n\n"
18                       "If the content\n"
19                       "of a tab\n"
20                       "becomes too\n"
21                       "longer\n"
22                       "than the\n"
23                       "container\n"
24                       "then it\n"
25                       "automatically\n"
26                       "becomes\n"
27                       "scrollable.\n"
28                       "\n"
29                       "\n"
30                       "\n"
31                       "Can you see it?");
32 
33     label = lv_label_create(tab2);
34     lv_label_set_text(label, "Second tab");
35 
36     label = lv_label_create(tab3);
37     lv_label_set_text(label, "Third tab");
38 
39     lv_obj_scroll_to_view_recursive(label, LV_ANIM_ON);
40 
41 }
42 #endif
43