How to set the size of the tabview buttons

Description

I try to set the size of the tabview buttons, but I recive a exception when I upload the code. How can I set the pad of the buttons or a smaller size? Thanks.

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

ESP32 with arduino Ide

What LVGL version are you using?

7.8

What do you want to achieve?

Set the icons center in the buttons

What have you tried so far?

Set the pad of the buttons.

Code to reproduce

lv_style_t style_TabView;
    lv_style_init(&style_TabView);
    lv_style_set_text_font(&style_TabView, LV_LABEL_PART_MAIN, &lv_font_montserrat_10);
    lv_style_set_pad_top(&style_TabView, LV_TABVIEW_PART_TAB_BTN, 5);
    
    
     // TAB
   tabview = lv_tabview_create(bg_middle, NULL);
   lv_obj_set_size(tabview, 320, 210);
   lv_tabview_set_btns_pos(tabview, LV_TABVIEW_TAB_POS_BOTTOM);
   lv_obj_add_style(tabview, LV_TABVIEW_PART_TAB_BTN, &style_TabView);

If I upload this code, the program reset each 2 seconds with the next exception:

10:20:40.164 -> Core 1 register dump:
10:20:40.164 -> PC : 0x4010be17 PS : 0x00060330 A0 : 0x800d7900 A1 : 0x3ffcc8f0
10:20:40.164 -> A2 : 0x3ffcce0c A3 : 0x000000bd A4 : 0xffffffff A5 : 0xffffffff
10:20:40.164 -> A6 : 0xffffffff A7 : 0x0000001b A8 : 0x000000bd A9 : 0x3ffcc8f0
10:20:40.164 -> A10 : 0x00000001 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x000000c0
10:20:40.164 -> A14 : 0x3ffc29e0 A15 : 0x00000140 SAR : 0x00000001 EXCCAUSE: 0x0000001c
10:20:40.197 -> EXCVADDR: 0x000000bd LBEG : 0x4010bd60 LEND : 0x4010bd6a LCOUNT : 0x00000000
10:20:40.197 ->
10:20:40.197 -> ELF file SHA256: 0000000000000000
10:20:40.197 ->
10:20:40.197 -> Backtrace: 0x4010be17:0x3ffcc8f0 0x400d78fd:0x3ffcc920 0x400d7e6f:0x3ffcc950 0x400d80fd:0x3ffcc970 0x400d5362:0x3ffcc9b0 0x400d5d10:0x3ffcc9e0 0x400e606a:0x3ffcca00 0x400e6407:0x3ffccc60 0x400d708e:0x3ffccc80 0x400d70f7:0x3ffcccd0 0x400d7130:0x3ffccd20 0x400d72dd:0x3ffccd40 0x400d76e6:0x3ffccdd0 0x400e07ef:0x3ffcce20 0x400e08d1:0x3ffcce40 0x400d19c9:0x3ffcce60 0x400f31cd:0x3ffcce80 0x400863fe:0x3ffccea0
10:20:40.232 ->
10:20:40.232 -> Rebooting…
10:20:40.232 -> ets Jun 8 2016 00:22:57
10:20:40.232 ->
10:20:40.232 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
10:20:40.232 -> configsip: 0, SPIWP:0xee
10:20:40.232 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
10:20:40.267 -> mode:DIO, clock div:1
10:20:40.267 -> load:0x3fff0018,len:4
10:20:40.267 -> load:0x3fff001c,len:1100
10:20:40.267 -> load:0x40078000,len:10900
10:20:40.267 -> load:0x40080400,len:6388
10:20:40.267 -> entry 0x400806b4

And this is the decode with the esp exception decoder

PC: 0x4010be17: _lv_style_list_get_transition_style at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_style.c line 700
EXCVADDR: 0x000000bd

Decoding stack results
0x4010be17: _lv_style_list_get_transition_style at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_style.c line 700
0x400d78fd: _lv_style_list_remove_style at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_style.c line 239
0x400d7e6f: _lv_style_get_ptr at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_style.c line 666
0x400d80fd: _lv_style_list_get_color at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_style.c line 870
0x400d5362: _lv_obj_get_style_int at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_obj.c line 2699
0x400d5d10: lv_obj_init_draw_rect_dsc at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core/lv_obj_style_dec.h line 122
0x400e606a: lv_btnmatrix_design at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_widgets\lv_btnmatrix.c line 690
0x400e6407: create_axis_label_iter at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_widgets\lv_chart.c line 1409
0x400d708e: lv_refr_obj at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_refr.c line 734
0x400d70f7: lv_refr_obj_and_children at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_refr.c line 656
0x400d7130: lv_refr_get_top_obj at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_refr.c line 596
0x400d72dd: _lv_inv_area at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_refr.c line 124
0x400d76e6: _lv_disp_refr_task at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\lv_refr.c line 406
0x400e07ef: lv_task_handler at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_misc\lv_task.c line 78
0x400e08d1: lv_task_handler at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_misc\lv_task.c line 172
0x400d19c9: loop() at C:\Users\alvar\Documents\Arduino\CO2_Interfaz_SIN_WIFI/loop.ino line 6
0x400f31cd: _GLOBAL__sub_I_loopTaskHandle() at C:\Users\alvar\Documents\Arduino\hardware\espressif\esp32\cores\esp32/IPAddress.h line 94
0x400863fe: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 143

Screenshot and/or video

This is the view if I don’t add the style:

ApplicationFrameHost_UgqvSRpZRB

Only with this code:

  lv_style_init(&smallFont);
  lv_style_set_text_font( &smallFont, LV_STATE_DEFAULT, &lv_font_montserrat_10);

  // TAB
   tabview = lv_tabview_create(bg_middle, NULL);
   lv_obj_set_size(tabview, 320, 210);
   lv_tabview_set_btns_pos(tabview, LV_TABVIEW_TAB_POS_BOTTOM);
   lv_obj_add_style(tabview, LV_TABVIEW_PART_TAB_BTN, &smallFont);

   
    tab1 = lv_tabview_add_tab(tabview, LV_SYMBOL_LIST);
    lv_page_set_scroll_propagation(tab1, true);
    lv_page_set_scrlbar_mode(tab1, LV_SCRLBAR_MODE_OFF);
    lv_obj_set_width(tab1, 320);
    
    tab2 = lv_tabview_add_tab(tabview, LV_SYMBOL_LOOP);
    lv_page_set_scroll_propagation(tab2, true);
    lv_page_set_scrlbar_mode(tab2, LV_SCRLBAR_MODE_OFF);
    lv_obj_set_width(tab1, 320);
    
    tab3 = lv_tabview_add_tab(tabview, LV_SYMBOL_SETTINGS);
    lv_page_set_scroll_propagation(tab3, true);
    lv_page_set_scrlbar_mode(tab3, LV_SCRLBAR_MODE_OFF);
    lv_obj_set_width(tab3, 320);

lv_style_t style_TabView; should be static or global to make it “live forever”. I assume now it’s a local variable and it goes out of the scope.