Hi,大家好,欢迎来到STM32之littlevGL课堂,我们在上节课中学习了表格控件(lv_table),本节课带大家学习选项卡控件,大家对选项卡熟悉吗? 一 有图有真相 没错,这就是一个非常简单的选项卡,就是你在做表格的时候,下面的几个表格切换按钮一样!我们可以通过切换选项从而在一个界面内展示更多的内容。 二 代码分析 void tabview_test(void) { /*Create a Tab view object*/ lv_obj_t *tabview; tabview = lv_tabview_create(lv_scr_act(), NULL); /*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, NULL); lv_label_set_text(label, "This the first tab\n\n" "If the content\n" "of a tab\n" "become too long\n" "the it \n" "automatically\n" "become\n" "scrollable."); label = lv_label_create(tab2, NULL); lv_label_set_text(label, "Second tab"); label = lv_label_create(tab3, NULL); lv_label_set_text(label, "Third tab"); } 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 * label = lv_label_create(tab1, NULL); lv_label_set_text(label, "This the first tab\n\n" "If the content\n" "of a tab\n" "become too long\n" "the it \n" "automatically\n" "become\n" "scrollable."); OK,本节课到就到这里,下节课我们学习窗口控件(lv_win),我们下节课再见! |