Description
I’d need the Arc (of the arc widget) be as large as the parent container allows and be centered horizontally. Since I don’t know how the parent container is large I set the width and height of the Arc widget to LV_PCT(100). This makes the widget as large as possible BUT if it gets more wide than high then the Arc itself is left aligned and I can’t find any way how to center it.
What MCU/Processor/Board and compiler are you using?
PC Linux
What LVGL version are you using?
9.2
What do you want to achieve?
centering of the Arc inside its own widget.
What have you tried so far?
Flex, grow and many other things, to no avail.
An idea: if it was possible to get the current height of the widget in pixels I could set the width to the same value but at runtime it returns height = 0.
Code to reproduce
lv_obj_t *container = lv_obj_create(lv_screen_active());
lv_obj_set_size(container, lv_pct(100), lv_pct(100));
lv_obj_center(container);
lv_obj_t* arc = lv_arc_create(container);
lv_obj_set_size(arc, lv_pct(100), lv_pct(100));
lv_obj_center(arc);
lv_obj_set_style_border_width(arc, 1, 0);
Screenshot and/or video
Thanks!