Fit rest of space

Hi,

your code was almost fine. The problem is if you apply LV_FIT_FLOOD on all sides of list and apply column layout an infinite cycle will be created like this:

  1. lvgl applies the layout
  2. but sees now list's size is not the same as the parent’s size so update it.
  3. upps, now the layout is wrong, so apply it again. (move the list below the top_container)
  4. okay but now the list is smaller than the parent again so set its size to the parent again
  5. but layout should be applied again…
  6. and so on…

So all you need to do is to don’t apply LV_FIT_FLOOD on the top side because you really don’t want that side to be at the top of the parent but below top_container.

lv_obj_t* container = lv_cont_create(lv_scr_act(), NULL);
lv_cont_set_layout(container, LV_LAYOUT_COL_L); /* set the layout to columns*/
lv_obj_set_size(container, 400, 300); /*Set the size of the parent container*/

lv_obj_t* top_container = lv_cont_create(container, NULL);
lv_obj_t* list = lv_page_create(container, NULL);
lv_cont_set_fit4(list, LV_FIT_FLOOD, LV_FIT_FLOOD, LV_FIT_NONE, LV_FIT_FLOOD); 

image