Description
What MCU/Processor/Board and compiler are you using?
nRF5340 / st7735r
What LVGL version are you using?
8.2
What do you want to achieve?
I want a label to center vertically according to the (dynamic) text that is put inside.
What have you tried so far?
I have set the label to wrap.
I have set the height of the label to 1 line.
I have set the text (too long for one line, may span 2 to 5 lines) of the label:
lv_label_set_text(ui_TempMessageField, "looong text looong text looong text looong text looong text looong text looong text looong text looong text looong text looong text looong text ");
I have called :
lv_obj_update_layout(ui_TempMessageField);
int curheight = lv_obj_get_height(ui_TempMessageField);
But the height is always the initial height. I did not find any way to get the height of the inner text (or number of lines), which I could have used to move the label to center it vertically inside its parent.
Also I have not found any flag to set vertical centering.
Thanks for any tip to center a dynamic label vertically.