feat(layout): add deferred layout recalculation
This commit is contained in:
@@ -11,8 +11,13 @@ static void float_btn_event_cb(lv_obj_t * float_btn, lv_event_t e)
|
||||
lv_snprintf(buf, sizeof(buf), "Track %d", btn_cnt);
|
||||
lv_obj_t * list_btn = lv_list_add_btn(list, LV_SYMBOL_AUDIO, buf, NULL);
|
||||
btn_cnt++;
|
||||
lv_obj_scroll_to_view(list_btn, LV_ANIM_ON);
|
||||
|
||||
lv_obj_move_foreground(float_btn);
|
||||
|
||||
/* Layouts are only recalculated later but we need to know the updated position of the new button
|
||||
* to scroll to it. */
|
||||
lv_obj_update_layout(list);
|
||||
lv_obj_scroll_to_view(list_btn, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user