mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-02 01:18:04 +08:00
ta: fix place holder alignment. Fixes #1241
This commit is contained in:
@@ -744,12 +744,14 @@ void lv_ta_set_text_align(lv_obj_t * ta, lv_label_align_t align)
|
|||||||
lv_obj_t * label = lv_ta_get_label(ta);
|
lv_obj_t * label = lv_ta_get_label(ta);
|
||||||
if(!ext->one_line) {
|
if(!ext->one_line) {
|
||||||
lv_label_set_align(label, align);
|
lv_label_set_align(label, align);
|
||||||
|
if(ext->placeholder) lv_label_set_align(ext->placeholder, align);
|
||||||
} else {
|
} else {
|
||||||
/*Normal left align. Just let the text expand*/
|
/*Normal left align. Just let the text expand*/
|
||||||
if(align == LV_LABEL_ALIGN_LEFT) {
|
if(align == LV_LABEL_ALIGN_LEFT) {
|
||||||
lv_label_set_long_mode(label, LV_LABEL_LONG_EXPAND);
|
lv_label_set_long_mode(label, LV_LABEL_LONG_EXPAND);
|
||||||
lv_page_set_scrl_fit2(ta, LV_FIT_TIGHT, LV_FIT_FLOOD);
|
lv_page_set_scrl_fit2(ta, LV_FIT_TIGHT, LV_FIT_FLOOD);
|
||||||
lv_label_set_align(label, align);
|
lv_label_set_align(label, align);
|
||||||
|
if(ext->placeholder) lv_label_set_align(ext->placeholder, align);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*Else use fix label width equal to the Text area width*/
|
/*Else use fix label width equal to the Text area width*/
|
||||||
@@ -757,6 +759,7 @@ void lv_ta_set_text_align(lv_obj_t * ta, lv_label_align_t align)
|
|||||||
lv_label_set_long_mode(label, LV_LABEL_LONG_CROP);
|
lv_label_set_long_mode(label, LV_LABEL_LONG_CROP);
|
||||||
lv_page_set_scrl_fit2(ta, LV_FIT_FLOOD, LV_FIT_FLOOD);
|
lv_page_set_scrl_fit2(ta, LV_FIT_FLOOD, LV_FIT_FLOOD);
|
||||||
lv_label_set_align(label, align);
|
lv_label_set_align(label, align);
|
||||||
|
if(ext->placeholder) lv_label_set_align(ext->placeholder, align);
|
||||||
|
|
||||||
lv_obj_set_width(label, lv_page_get_fit_width(ta));
|
lv_obj_set_width(label, lv_page_get_fit_width(ta));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user