A39模拟器
This commit is contained in:
14
MXC-A39/lvgl/examples/widgets/tabview/index.rst
Normal file
14
MXC-A39/lvgl/examples/widgets/tabview/index.rst
Normal file
@ -0,0 +1,14 @@
|
||||
C
|
||||
^
|
||||
|
||||
Simple Tabview
|
||||
"""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: widgets/tabview/lv_example_tabview_1
|
||||
:language: c
|
||||
|
||||
|
||||
MicroPython
|
||||
^^^^^^^^^^^
|
||||
|
||||
No examples yet.
|
42
MXC-A39/lvgl/examples/widgets/tabview/lv_example_tabview_1.c
Normal file
42
MXC-A39/lvgl/examples/widgets/tabview/lv_example_tabview_1.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_TABVIEW && LV_BUILD_EXAMPLES
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
#endif
|
@ -0,0 +1,25 @@
|
||||
# Create a Tab view object
|
||||
tabview = lv.tabview(lv.scr_act())
|
||||
|
||||
# Add 3 tabs (the tabs are page (lv_page) and can be scrolled
|
||||
tab1 = tabview.add_tab("Tab 1")
|
||||
tab2 = tabview.add_tab("Tab 2")
|
||||
tab3 = tabview.add_tab("Tab 3")
|
||||
|
||||
# Add content to the tabs
|
||||
label = lv.label(tab1)
|
||||
label.set_text("""This the first tab
|
||||
|
||||
If the content
|
||||
of a tab
|
||||
become too long
|
||||
the it
|
||||
automatically
|
||||
become
|
||||
scrollable.""")
|
||||
|
||||
label = lv.label(tab2)
|
||||
label.set_text("Second tab")
|
||||
|
||||
label = lv.label(tab3)
|
||||
label.set_text("Third tab")
|
Reference in New Issue
Block a user