acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_example_flex_1.c (1311B)
1 #include "../../lv_examples.h" 2 #if LV_USE_FLEX && LV_BUILD_EXAMPLES 3 4 /** 5 * A simple row and a column layout with flexbox 6 */ 7 void lv_example_flex_1(void) 8 { 9 /*Create a container with ROW flex direction*/ 10 lv_obj_t * cont_row = lv_obj_create(lv_scr_act()); 11 lv_obj_set_size(cont_row, 300, 75); 12 lv_obj_align(cont_row, LV_ALIGN_TOP_MID, 0, 5); 13 lv_obj_set_flex_flow(cont_row, LV_FLEX_FLOW_ROW); 14 15 /*Create a container with COLUMN flex direction*/ 16 lv_obj_t * cont_col = lv_obj_create(lv_scr_act()); 17 lv_obj_set_size(cont_col, 200, 150); 18 lv_obj_align_to(cont_col, cont_row, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); 19 lv_obj_set_flex_flow(cont_col, LV_FLEX_FLOW_COLUMN); 20 21 uint32_t i; 22 for(i = 0; i < 10; i++) { 23 lv_obj_t * obj; 24 lv_obj_t * label; 25 26 /*Add items to the row*/ 27 obj = lv_btn_create(cont_row); 28 lv_obj_set_size(obj, 100, LV_PCT(100)); 29 30 label = lv_label_create(obj); 31 lv_label_set_text_fmt(label, "Item: %u", i); 32 lv_obj_center(label); 33 34 /*Add items to the column*/ 35 obj = lv_btn_create(cont_col); 36 lv_obj_set_size(obj, LV_PCT(100), LV_SIZE_CONTENT); 37 38 label = lv_label_create(obj); 39 lv_label_set_text_fmt(label, "Item: %"LV_PRIu32, i); 40 lv_obj_center(label); 41 } 42 } 43 44 #endif