mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-01 16:58:33 +08:00
ddlist: fix label alignment after style change
This commit is contained in:
@@ -662,6 +662,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
|||||||
|
|
||||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||||
lv_ddlist_refr_size(ddlist, 0);
|
lv_ddlist_refr_size(ddlist, 0);
|
||||||
|
|
||||||
} else if(sign == LV_SIGNAL_CLEANUP) {
|
} else if(sign == LV_SIGNAL_CLEANUP) {
|
||||||
ext->label = NULL;
|
ext->label = NULL;
|
||||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||||
@@ -980,11 +981,19 @@ static void lv_ddlist_pos_current_option(lv_obj_t * ddlist)
|
|||||||
*/
|
*/
|
||||||
static void lv_ddlist_refr_width(lv_obj_t * ddlist)
|
static void lv_ddlist_refr_width(lv_obj_t * ddlist)
|
||||||
{
|
{
|
||||||
|
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||||
|
|
||||||
/*Set the TIGHT fit horizontally the set the width to the content*/
|
/*Set the TIGHT fit horizontally the set the width to the content*/
|
||||||
lv_page_set_scrl_fit2(ddlist, LV_FIT_TIGHT, lv_page_get_scrl_fit_bottom(ddlist));
|
lv_page_set_scrl_fit2(ddlist, LV_FIT_TIGHT, lv_page_get_scrl_fit_bottom(ddlist));
|
||||||
|
|
||||||
/*Revert FILL fit to fill the parent with the options area. It allows to RIGHT/CENTER align the text*/
|
/*Revert FILL fit to fill the parent with the options area. It allows to RIGHT/CENTER align the text*/
|
||||||
lv_page_set_scrl_fit2(ddlist, LV_FIT_FILL, lv_page_get_scrl_fit_bottom(ddlist));
|
lv_page_set_scrl_fit2(ddlist, LV_FIT_FILL, lv_page_get_scrl_fit_bottom(ddlist));
|
||||||
|
|
||||||
|
switch(lv_label_get_align(ext->label)) {
|
||||||
|
case LV_LABEL_ALIGN_LEFT: lv_obj_align(ext->label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0); break;
|
||||||
|
case LV_LABEL_ALIGN_CENTER: lv_obj_align(ext->label, NULL, LV_ALIGN_CENTER, 0, 0); break;
|
||||||
|
case LV_LABEL_ALIGN_RIGHT: lv_obj_align(ext->label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0); break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user