Migrating from 7.5 to 8.1 - Tabview padding

Description

In 7.5 I used to be able to pad the tabview to allow me to put some test at the top left. How can this be done in 8.1?

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

Simulator

What LVGL version are you using?

8.1

What do you want to achieve?

Put the time at the top left

What have you tried so far?

Review the docs

Code to reproduce

This is what I had in 7.5

    lv_obj_t * tv = lv_tabview_create(scr, LV_DIR_TOP, 50);
    lv_obj_set_height(tv, 535);
    // lv_obj_set_width(tv, 1000);
    // LV_TABVIEW_PART_BG

    // lv_obj_set_style_local_pad_left(tv, LV_TABVIEW_PART_TAB_BG, LV_STATE_DEFAULT, LV_HOR_RES / 8);
    lv_obj_set_style_pad_right(tv, LV_STATE_DEFAULT, LV_HOR_RES / 6);
    lblMenuTime = lv_label_create(lv_scr_act());
    // lv_obj_set_style(lblFooterTime, &st_footer_red );
    lv_label_set_text(lblMenuTime, "00:00");
    // lv_obj_set_pos(lblMenuTime, LV_HOR_RES_MAX - 100, LV_DPX(10));
    lv_obj_align(lblMenuTime, LV_ALIGN_TOP_RIGHT, -70, 8);

Screenshot and/or video

It should look like:

Thanks!

Try this:

    lv_obj_t * btnm = lv_tabview_get_tab_btns(tabview);
    lv_obj_set_style_pad_left(btnm, 20, 0);
    lv_obj_set_style_pad_right(btnm, 40, 0);

Unfortunately that didnt work :frowning:

I did combine this with one of your other fixes:

    lv_obj_t * btnm = lv_tabview_get_tab_btns(tv);
    lv_obj_set_style_pad_left(btnm, 20, 0);
    lv_obj_set_style_pad_right(btnm, 40, 0);
    
    lv_obj_set_style_outline_width(btnm, 0, LV_STATE_FOCUS_KEY);
    lv_obj_set_style_outline_width(btnm, 0, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);

But no luck, any other ideas?

Thanks!

It looks like this for me:
image

Please send a screenshot about how it looks like now.

My apologies. The offset of 40 wasnt visible enough for me to notice it working :frowning:

I set it to 150 and it looks like:

Thank you so much!

Final code:

    lv_obj_t * btnm = lv_tabview_get_tab_btns(tv);
    lv_obj_set_style_pad_right(btnm, 150, 0);    
    lv_obj_set_style_outline_width(btnm, 0, LV_STATE_FOCUS_KEY);
    lv_obj_set_style_outline_width(btnm, 0, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);

Okay, great! :slight_smile: