Description
I try the List demo in github/lv_example_list_1.c and modify some code to change the button style. But after I press the button, it seems that button become wider than before. It isn’t what I want. It should have same size whether pressed or not.
What MCU/Processor/Board and compiler are you using?
STM32F407ZG, RT-Thread RTOS
What do you want to achieve?
I want to design a new style for button on the list. But it stretch when I pressed button.
Code to reproduce
Here is the style code I add in function void lv_example_list_1(void).
static lv_style_t style_btn;
lv_style_init(&style_btn);
lv_style_set_bg_color(&style_btn, lv_color_hex(0x115588));
lv_style_set_bg_opa(&style_btn, LV_OPA_50);
lv_style_set_border_width(&style_btn, 1);
lv_style_set_border_color(&style_btn, lv_color_black());
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
btn = lv_list_add_btn(list1, LV_SYMBOL_DIRECTORY, "Open");
lv_obj_add_style(btn, &style_btn, LV_STATE_DEFAULT | LV_PART_MAIN);
lv_obj_add_style(btn, &style_btn, LV_STATE_PRESSED);
Screenshot and/or video
You can see that the blue background becomes wider after I press the button. I want to solve this problem. Thanks.