How to set the size of a tabview an tabs correct

Description

I’m trying to set the size of a tabview like the size of his parent, but I can`t display correctly. Also I would like to set the height of the tab buttons smaller but I can’t find how to do.

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

ESP32 nodeMCU with Arduino IDE and ili9341 240x320 display

What LVGL version are you using?

7.8.1

What do you want to achieve?

Display the tabview full screen and set the tab heights smaller

Code to reproduce

The code block(s) should be formatted like:

r//MIDDLE
    bg_middle = lv_obj_create(scr, NULL);
    lv_obj_clean_style_list(bg_middle, LV_OBJ_PART_MAIN);
    lv_obj_set_style_local_bg_opa(bg_middle, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT,LV_OPA_COVER);
    lv_obj_set_style_local_bg_color(bg_middle, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
    lv_obj_set_pos(bg_middle, 0, 50);
    lv_obj_set_size(bg_middle, LV_HOR_RES, 320);
    lv_obj_set_size(bg_middle, LV_VER_RES, 190);

 // TAB
   tabview = lv_tabview_create(bg_middle, NULL);
   lv_obj_set_size(tabview, LV_HOR_RES, 320);
   lv_obj_set_size(tabview, LV_VER_RES, 190);
   lv_tabview_set_btns_pos(tabview, LV_TABVIEW_TAB_POS_BOTTOM);
   lv_obj_add_style(tabview, LV_TABVIEW_PART_TAB_BTN, &smallFont);
  
    lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Medidas");
    lv_page_set_scroll_propagation(tab1, false);
    lv_obj_t *tab2 = lv_tabview_add_tab(tabview, "Graficos");
    lv_page_set_scroll_propagation(tab2, false);
    lv_obj_t *tab3 = lv_tabview_add_tab(tabview, "Ajustes");
    lv_page_set_scroll_propagation(tab3, false);

If I set the width an height with I can disply the tabs at the bottom but they don’t have the correct width

  lv_obj_set_size(tabview, LV_HOR_RES, 320);
   lv_obj_set_size(tabview, LV_VER_RES, 190);

Screenshot and/or video

ApplicationFrameHost_VRlytsKVtA

lv_obj_set_size takes two parameters - one for the width of the object, and one for the height. At the moment you’re calling it twice with the wrong parameters. I think fixing that will solve your problem.

Thanks, but now the i was wrong in my code, how can I set the height of the tabs now? And now the lv_page_set_scroll_propagation(tab1, false); doesn’t work. Thanks in advance

ApplicationFrameHost_B4Z0TNt3Hb

This worked for me, changing the values of pad_top and pad_bottom:

    lv_style_t style_TabView;
    lv_style_init(&style_TabView);
    lv_style_set_text_font(&style_TabView, LV_LABEL_PART_MAIN, &smallFont);
    lv_style_set_pad_top(&style_TabView, LV_BTNMATRIX_PART_BG, 5);
    lv_style_set_pad_bottom(&style_TabView, LV_BTNMATRIX_PART_BG, 5);

Then apply the style to the tabview:

    lv_obj_add_style(tabview, LV_TABVIEW_PART_TAB_BTN, &style_TabView);

It doesn’t work for me, it gives me the next exception:

13:51:03.506 → Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.
13:51:03.506 → Core 1 register dump:
13:51:03.506 → PC : 0x4010bbfb PS : 0x00060330 A0 : 0x800d7e58 A1 : 0x3ffcc860
13:51:03.506 → A2 : 0x3ffccd7c A3 : 0x000000bd A4 : 0x3ffc2017 A5 : 0xffffffff
13:51:03.506 → A6 : 0xffffffff A7 : 0x00000007 A8 : 0x000000bd A9 : 0x0000000d
13:51:03.540 → A10 : 0x00000001 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x000000c2
13:51:03.540 → A14 : 0x3ffc2840 A15 : 0x00000140 SAR : 0x00000001 EXCCAUSE: 0x0000001c
13:51:03.540 → EXCVADDR: 0x000000bd LBEG : 0x4010bb44 LEND : 0x4010bb4e LCOUNT : 0x00000000
13:51:03.540 →
13:51:03.540 → ELF file SHA256: 0000000000000000
13:51:03.540 →
13:51:03.540 → Backtrace: 0x4010bbfb:0x3ffcc860 0x400d7e55:0x3ffcc890 0x400d8473:0x3ffcc8c0 0x400d8711:0x3ffcc8e0 0x400d57cd:0x3ffcc920 0x400d61a8:0x3ffcc950 0x400e728a:0x3ffcc970 0x400e7623:0x3ffccbd0 0x400d75a6:0x3ffccbf0 0x400d760f:0x3ffccc40 0x400d7648:0x3ffccc90 0x400d780d:0x3ffcccb0 0x400d7c26:0x3ffccd40 0x400e1ad3:0x3ffccd90 0x400e1bb5:0x3ffccdb0 0x400d1b23:0x3ffccdd0 0x400f2fc5:0x3ffccdf0 0x400863fe:0x3ffcce10
13:51:03.574 →
13:51:03.574 → Rebooting…
13:51:03.574 → ets Jun 8 2016 00:22:57
13:51:03.609 →
13:51:03.609 → rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
13:51:03.609 → configsip: 0, SPIWP:0xee
13:51:03.609 → clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
13:51:03.609 → mode:DIO, clock div:1
13:51:03.609 → load:0x3fff0018,len:4
13:51:03.609 → load:0x3fff001c,len:1100
13:51:03.609 → load:0x40078000,len:10900
13:51:03.609 → load:0x40080400,len:6388
13:51:03.609 → entry 0x400806b413:51:03.506 → Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.
13:51:03.506 → Core 1 register dump:
13:51:03.506 → PC : 0x4010bbfb PS : 0x00060330 A0 : 0x800d7e58 A1 : 0x3ffcc860
13:51:03.506 → A2 : 0x3ffccd7c A3 : 0x000000bd A4 : 0x3ffc2017 A5 : 0xffffffff
13:51:03.506 → A6 : 0xffffffff A7 : 0x00000007 A8 : 0x000000bd A9 : 0x0000000d
13:51:03.540 → A10 : 0x00000001 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x000000c2
13:51:03.540 → A14 : 0x3ffc2840 A15 : 0x00000140 SAR : 0x00000001 EXCCAUSE: 0x0000001c
13:51:03.540 → EXCVADDR: 0x000000bd LBEG : 0x4010bb44 LEND : 0x4010bb4e LCOUNT : 0x00000000
13:51:03.540 →
13:51:03.540 → ELF file SHA256: 0000000000000000
13:51:03.540 →
13:51:03.540 → Backtrace: 0x4010bbfb:0x3ffcc860 0x400d7e55:0x3ffcc890 0x400d8473:0x3ffcc8c0 0x400d8711:0x3ffcc8e0 0x400d57cd:0x3ffcc920 0x400d61a8:0x3ffcc950 0x400e728a:0x3ffcc970 0x400e7623:0x3ffccbd0 0x400d75a6:0x3ffccbf0 0x400d760f:0x3ffccc40 0x400d7648:0x3ffccc90 0x400d780d:0x3ffcccb0 0x400d7c26:0x3ffccd40 0x400e1ad3:0x3ffccd90 0x400e1bb5:0x3ffccdb0 0x400d1b23:0x3ffccdd0 0x400f2fc5:0x3ffccdf0 0x400863fe:0x3ffcce10
13:51:03.574 →
13:51:03.574 → Rebooting…
13:51:03.574 → ets Jun 8 2016 00:22:57
13:51:03.609 →
13:51:03.609 → rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
13:51:03.609 → configsip: 0, SPIWP:0xee
13:51:03.609 → clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
13:51:03.609 → mode:DIO, clock div:1
13:51:03.609 → load:0x3fff0018,len:4
13:51:03.609 → load:0x3fff001c,len:1100
13:51:03.609 → load:0x40078000,len:10900
13:51:03.609 → load:0x40080400,len:6388
13:51:03.609 → entry 0x400806b4

PC: 0x4010bbfb: get_style_prop at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_style.c line 1145 0x4010bbfb: get_style_prop at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_style.c line 1145 0x400d7e55: get_property_index at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_style.c line 1158 0x400d8473: _lv_style_get_color at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_style.c line 626 0x400d8711: _lv_style_list_get_int at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_style.c line 832 0x400d57cd: _lv_obj_get_style_int at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_obj.c line 2670 0x400d61a8: lv_obj_init_draw_rect_dsc at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core/ lv_obj_style_dec.h line 102 0x400e728a: lv_btnmatrix_design at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_widgets\ lv_btnmatrix.c line 674 0x400e7623: lv_btnmatrix_design at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_widgets\ lv_btnmatrix.c line 637 0x400d75a6: lv_refr_obj at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 677 0x400d760f: lv_refr_obj at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 717 0x400d7648: lv_refr_obj_and_children at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 619 0x400d780d: lv_refr_area_part at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 550 0x400d7c26: _lv_disp_refr_task at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 460 0x400e1ad3: lv_task_exec at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_misc\ lv_task.c line 409 0x400e1bb5: lv_task_handler at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_misc\ lv_task.c line 142 0x400d1b23: loop() at C:\Users\alvar\Documents\Arduino\CO2_Interfaz_SIN_WIFI/ loop.ino line 4 0x400f2fc5: loopTask(void)* at C:\Users\alvar\Documents\Arduino\hardware\espressif\esp32\cores\esp32\ main.cpp line 19 0x400863fe: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/ port.c line 143 EXCVADDR: 0x000000bd Decoding stack results 0x4010bbfb: get_style_prop at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_style.c line 1145 0x400d7e55: get_property_index at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_style.c line 1158 0x400d8473: _lv_style_get_color at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_style.c line 626 0x400d8711: _lv_style_list_get_int at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_style.c line 832 0x400d57cd: _lv_obj_get_style_int at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_obj.c line 2670 0x400d61a8: lv_obj_init_draw_rect_dsc at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core/ lv_obj_style_dec.h line 102 0x400e728a: lv_btnmatrix_design at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_widgets\ lv_btnmatrix.c line 674 0x400e7623: lv_btnmatrix_design at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_widgets\ lv_btnmatrix.c line 637 0x400d75a6: lv_refr_obj at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 677 0x400d760f: lv_refr_obj at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 717 0x400d7648: lv_refr_obj_and_children at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 619 0x400d780d: lv_refr_area_part at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 550 0x400d7c26: _lv_disp_refr_task at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_core\ lv_refr.c line 460 0x400e1ad3: lv_task_exec at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_misc\ lv_task.c line 409 0x400e1bb5: lv_task_handler at C:\Users\alvar\Documents\Arduino\libraries\lvgl-master\src\lv_misc\ lv_task.c line 142 0x400d1b23: loop() at C:\Users\alvar\Documents\Arduino\CO2_Interfaz_SIN_WIFI/ loop.ino line 4 0x400f2fc5: loopTask(void)* at C:\Users\alvar\Documents\Arduino\hardware\espressif\esp32\cores\esp32\ main.cpp line 19 0x400863fe: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/ port.c line 143