Dynamically resizing a display


What MCU/Processor/Board and compiler are you using?


What do you want to achieve?

I want to change the logical display width/height in LittlevGL and have the whole UI redraw itself.

What have you tried so far?

I have implemented the ability to resize my window, but I’m not sure how to safely inform LittlevGL that the display size just changed.

Code to reproduce

I don’t think this should be necessary.

Screenshot and/or video

Right now LittlevGL appears in the top left corner of my window at the default size and the remaining space is black.


You should use lv_disp_drv_update

Thanks! That works perfectly.

How do I force the whole screen to be refreshed? At the moment I am using lv_obj_invalidate(lv_disp_get_scr_act(disp)) but I’m not sure if that is the right way to do it or not (plus that won’t refresh the top/sys layers).

Sys and Top layers are always drawn so lv_obj_invalidate(lv_disp_get_scr_act(disp)) should be fine. Note that if you have only one display lv_obj_invalidate(lv_scr_act()) also works.

1 Like