Vertical alignment for a label

Description

What MCU/Processor/Board and compiler are you using?

Custom board with a STM32H753 MCU

What LVGL version are you using?

Latest v8.3 release

What do you want to achieve?

Vertical alignment for the text of a label.

What have you tried so far?

I found this old thread however seems to be updated by now since lv_obj_align_mid is not present in the API anymore.

have you tried lv_obj_center()?

If I’m not wrong that would center the label inside the parent object, but what I want is to center the text inside the label. Maybe I could use a container for the label, however I’d like to avoid it if I can.

I see. I’m fairly certain the
lv_obj_set_style_text_align() function does that. See Label (lv_label) — LVGL documentation

Actually I think not; but I think the official solution as reported here is to use a container

1 Like