Description
I have a label that contains often short texts but in a error case it can have longer texts that should be placed on several lines.
So i use:
lv_label_set_long_mode(label_error_text, LV_LABEL_LONG_BREAK);
How can I make the text in the label allways vertical center alligned on my display?
What LVGL version are you using?
7.10.1
What do you want to achieve?
A vertical center alligned label with line break.
What have you tried so far?
lv_obj_align to “Center”, but this has a reverence of the label to the upper left corner from the label. I need to center on the vertical center of the label it selve.
Code to reproduce
label_error_text = lv_label_create(lv_scr_act(), NULL);
lv_label_set_long_mode(label_error_text, LV_LABEL_LONG_BREAK); /*Break the long lines*/
lv_label_set_align(label_error_text, LV_LABEL_ALIGN_LEFT); /*Left aligned lines*/
lv_obj_set_size(label_error_text, (LV_HOR_RES_MAX-ERR_TEXT_HOR), LV_VER_RES_MAX);
lv_obj_set_pos(label_error_text, ERR_TEXT_HOR, 0);
lv_obj_set_style_local_text_font(label_error_text, LV_LABEL_PART_MAIN , LV_STATE_DEFAULT, lv_theme_get_font_normal()); /*sets the text size*/
Thank you for your always great help!