api(align) save align in style and handle x/y according to it
This commit is contained in:
@@ -9,13 +9,13 @@ void lv_example_flex_1(void)
|
||||
/*Create a container with ROW flex direction*/
|
||||
lv_obj_t * cont_row = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_size(cont_row, 300, 75);
|
||||
lv_obj_align(cont_row, NULL, LV_ALIGN_IN_TOP_MID, 0, 5);
|
||||
lv_obj_align(cont_row, LV_ALIGN_TOP_MID, 0, 5);
|
||||
lv_obj_set_flex_flow(cont_row, LV_FLEX_FLOW_ROW);
|
||||
|
||||
/*Create a container with COLUMN flex direction*/
|
||||
lv_obj_t * cont_col = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_size(cont_col, 200, 150);
|
||||
lv_obj_align(cont_col, cont_row, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
|
||||
lv_obj_align_to(cont_col, cont_row, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
|
||||
lv_obj_set_flex_flow(cont_col, LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
uint32_t i;
|
||||
@@ -29,7 +29,7 @@ void lv_example_flex_1(void)
|
||||
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "Item: %d", i);
|
||||
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_center(label);
|
||||
|
||||
/*Add items to the column*/
|
||||
obj = lv_obj_create(cont_col);
|
||||
@@ -37,7 +37,7 @@ void lv_example_flex_1(void)
|
||||
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "Item: %d", i);
|
||||
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_center(label);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user