Important: unclear posts may not receive useful answers.
Before posting
- Get familiar with Markdown to format and structure your post
- Be sure to update lvgl from the latest version from the
master
branch.- Be sure you have checked the relevant part of the documentation.
- If applicable use the Simulator to eliminate hardware related issues.
Delete this section if you read and applied the mentioned points.
Description
There is a problem that the previous screen is erased to white when switching screens.
What MCU/Processor/Board and compiler are you using?
Visual studio 2017 simulation
What LVGL version are you using?
v7.11
What do you want to achieve?
I hope it looks like the link below.
What have you tried so far?
I looked at the docs but couldn’t find a solution.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
lv_obj_t* btn1;
lv_obj_t* btn2;
LV_EVENT_CB_DECLARE(button_event_cb)
{
if ((obj == btn1) && (e == LV_EVENT_CLICKED))
{
printf("forward btn clicked\n\r");
lv_scr_load_anim(screen2, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 200, false);
// lv_scr_load(screen2);
}
else if ((obj == btn2) && (e == LV_EVENT_CLICKED))
{
printf("back btn clicked\n\r");
lv_scr_load_anim(screen1, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 200, false);
// lv_scr_load(screen1);
}
}
void button_demo_main_window_create(lv_obj_t * p)
{
(void)p;
LV_THEME_DEFAULT_INIT(lv_theme_get_color_primary(), lv_theme_get_color_secondary(),
LV_THEME_MATERIAL_FLAG_DARK,
lv_theme_get_font_small(), lv_theme_get_font_small(), lv_theme_get_font_normal(), lv_theme_get_font_normal());
_lv_obj_set_style_local_color(lv_scr_act(), LV_BTN_PART_MAIN, LV_STYLE_BG_COLOR, LV_COLOR_BLACK);
screen1 = lv_scr_act(); //lv_obj_create(NULL, NULL);
screen2 = lv_obj_create(NULL, NULL);
_lv_obj_set_style_local_color(screen1, LV_BTN_PART_MAIN, LV_STYLE_BG_COLOR, LV_COLOR_YELLOW);
_lv_obj_set_style_local_color(screen2, LV_BTN_PART_MAIN, LV_STYLE_BG_COLOR, LV_COLOR_BLUE);
// button_demo_main_window_create(lv_scr_act());
scr1_create();
scr2_create();
// lv_disp_set_default(screen1);
lv_scr_load(screen1);
}
void scr1_create(void)
{
lv_obj_t* la;
btn1 = lv_btn_create(screen1, NULL);
lv_obj_align(btn1, screen1, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_event_cb(btn1, button_event_cb);
la = lv_label_create(btn1, NULL);
lv_label_set_text(la, "SCREEN2");
lv_obj_align(la, btn1, LV_ALIGN_CENTER, 0, 0);
}
void scr2_create(void)
{
lv_obj_t* la;
btn2 = lv_btn_create(screen2, NULL);
lv_obj_align(btn2, screen2, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_event_cb(btn2, button_event_cb);
la = lv_label_create(btn2, NULL);
lv_label_set_text(la, "SCREEN1");
lv_obj_align(la, btn2, LV_ALIGN_CENTER, 0, 0);
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.