1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00
lvgl/examples/layouts/flex/lv_example_flex_3.c

31 lines
837 B
C
Raw Normal View History

2021-04-08 13:07:48 +02:00
#include "../../lv_examples.h"
2021-02-14 14:56:34 +01:00
#if LV_USE_FLEX && LV_BUILD_EXAMPLES
2021-02-12 14:22:48 +01:00
/**
* Demonstrate flex grow.
2021-02-12 14:22:48 +01:00
*/
void lv_example_flex_3(void)
{
lv_obj_t * cont = lv_obj_create(lv_scr_act());
2021-02-12 14:22:48 +01:00
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW);
2021-02-12 14:22:48 +01:00
lv_obj_t * obj;
obj = lv_obj_create(cont);
lv_obj_set_size(obj, 40, 40); /*Fix size*/
2021-02-12 14:22:48 +01:00
obj = lv_obj_create(cont);
lv_obj_set_height(obj, 40);
2021-02-12 14:22:48 +01:00
lv_obj_set_flex_grow(obj, 1); /*1 portion from the free space*/
obj = lv_obj_create(cont);
2021-02-12 14:22:48 +01:00
lv_obj_set_height(obj, 40);
lv_obj_set_flex_grow(obj, 2); /*2 portion from the free space*/
obj = lv_obj_create(cont);
lv_obj_set_size(obj, 40, 40); /*Fix size. It is flushed to the right by the "grow" items*/
2021-02-12 14:22:48 +01:00
}
#endif