1 #include "../../lv_examples.h"
2 #if LV_USE_TILEVIEW && LV_BUILD_EXAMPLES
3 
4 /**
5  * Create a 2x2 tile view and allow scrolling only in an "L" shape.
6  * Demonstrate scroll chaining with a long list that
7  * scrolls the tile view when it can't be scrolled further.
8  */
lv_example_tileview_1(void)9 void lv_example_tileview_1(void)
10 {
11     lv_obj_t * tv = lv_tileview_create(lv_scr_act());
12 
13     /*Tile1: just a label*/
14     lv_obj_t * tile1 = lv_tileview_add_tile(tv, 0, 0, LV_DIR_BOTTOM);
15     lv_obj_t * label = lv_label_create(tile1);
16     lv_label_set_text(label, "Scroll down");
17     lv_obj_center(label);
18 
19     /*Tile2: a button*/
20     lv_obj_t * tile2 = lv_tileview_add_tile(tv, 0, 1, LV_DIR_TOP | LV_DIR_RIGHT);
21 
22     lv_obj_t * btn = lv_btn_create(tile2);
23 
24     label = lv_label_create(btn);
25     lv_label_set_text(label, "Scroll up or right");
26 
27     lv_obj_set_size(btn, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
28     lv_obj_center(btn);
29 
30     /*Tile3: a list*/
31     lv_obj_t * tile3 = lv_tileview_add_tile(tv, 1, 1, LV_DIR_LEFT);
32     lv_obj_t * list = lv_list_create(tile3);
33     lv_obj_set_size(list, LV_PCT(100), LV_PCT(100));
34 
35     lv_list_add_btn(list, NULL, "One");
36     lv_list_add_btn(list, NULL, "Two");
37     lv_list_add_btn(list, NULL, "Three");
38     lv_list_add_btn(list, NULL, "Four");
39     lv_list_add_btn(list, NULL, "Five");
40     lv_list_add_btn(list, NULL, "Six");
41     lv_list_add_btn(list, NULL, "Seven");
42     lv_list_add_btn(list, NULL, "Eight");
43     lv_list_add_btn(list, NULL, "Nine");
44     lv_list_add_btn(list, NULL, "Ten");
45 
46 }
47 
48 #endif
49