Label alignment error

When I center the two labels, the label below is not right in the middle.

lv_obj_t * label_songs_name = lv_label_create(page, NULL);
lv_obj_set_pos(label_songs_name, 527, 70);
lv_label_set_style(label_songs_name, LV_LABEL_STYLE_MAIN, &page_style);
lv_label_set_text(label_songs_name, "My heart will go on");

lv_obj_t * label_singer = lv_label_create(page, NULL);
lv_obj_align(label_singer, label_songs_name, LV_ALIGN_OUT_BOTTOM_MID, 0, 18);
lv_label_set_style(label_singer, LV_LABEL_STYLE_MAIN, &lrc_style);
lv_label_set_text(label_singer, "Celine Dion");

%E6%AD%8C%E8%AF%8D

and is there a plan to develop a lyric obj?

You must realign after lv_label_set_text.

wow,you are wright.Thank you very much.

You can also enable auto realignment (lv_obj_set_auto_realign(obj, true)) which would automatically correct the alignment whenever the text changes.

2 Likes

thank you!