Label horizontal dynamic centering

Description

I want to center a label horizontally dynamically according content without modifying original y position, using the simplest solution.

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

ESP Core S3 (M5Dial) / Arduino /platform IO / EEZ Studio

What LVGL version are you using?

9.2.2

What have you tried so far?

int y = lv_obj_get_y(label);
lv_obj_center(label);
lv_obj_set_y(label, y);

maybe you can use lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);

I just tried , and it does not seem to do the trick, With or without this line, i got the same result . thx anyway !