While porting from V7 to V8 I cannot find an equivalent for autofit functionality used with V7 containers.
e.g. To fit to the size of the children
lv_cont_set_fit2( cont, LV_FIT_PARENT, LV_FIT_TIGHT );
There doesn’t appear to be the equivalent in the
lv_obj_t and I can’t see how to do it with the new flex layout?
The flex examples all set the size manually prior to adding children, so maybe this is the way to go but bit of a pain to port.
Any suggestions welcome.
To answer my own question, the API to do this is
lv_obj_set_size/width/height with parameter
LV_SIZE_CONTENT. This is the equivalent for
LV_FIT_PARENT use the new
LV_PCT(value) which defines a dimension as a percentage of the parents, e.g.
lv_obj_set_width( obj, LV_PCT(20)); sets the objects width to 20% of the parents width.
thanks for having answered to your own question, it helps me
Now I need it automaticly adapt when children are hidden