Description
I’m converting an app I built from V7.11 to V8.1 and have the most of it done.
I’m facing an issue where I am unable to set the background color of the main screen object. No matter what I do, it stays white and I can only override it by using the following line of code:
lv_obj_set_style_bg_color(lv_scr_act(), LV_COLOR_MAKE(0, 0, 0), LV_STATE_DEFAULT);
Also, I seem to have a memory leak each time I navigate back and forth between screens.
What’s the best way to delete a screen object after it has been animated out?
What MCU/Processor/Board and compiler are you using?
Teensy Micromod (IMXRT1062)
What LVGL version are you using?
V8.1
What do you want to achieve?
Change the background color & delete the main screen object after animating out to another screen.
What have you tried so far?
See code example below
Code to reproduce
lv_obj_t * gaugeScreen; // This is a global object and various screens are assigned to this object to be displayed
void openScreen(){
static lv_style_t mainScreen;
lv_style_init(&mainScreen);
lv_style_set_bg_color(&mainScreen, lv_color_hex(0x000000));
lv_style_set_border_width(&mainScreen, 0);
lv_style_set_radius(&mainScreen, 0);
lv_obj_t * obj0 = lv_obj_create(gaugeScreen); // Main screen object. Everything else is assigned to this object
lv_obj_remove_style_all(obj0);
lv_obj_set_size(obj0, 480, 320);
lv_obj_set_pos(obj0, 0,0);
lv_obj_add_style(obj0, &mainScreen, LV_PART_MAIN);
lv_obj_set_scrollbar_mode(obj0, LV_SCROLLBAR_MODE_OFF);
}