Delete a TAB after the tabView scroll animation is complete

I’m going to go from tabView ID =2 to ID =1, and then I’m going to delete tabView ID =2, and I want to delete a tabView ID =2 after the entire slide animation, instead of deleting the TabView ID =2 in the middle of the animation.How do I do that?

If you’re using a normal animation, delete tabview 2 inside the function you pass to lv_anim_set_ready_cb.

Hello, I am using version 7.4, and I still don’t use tabview. After sliding to another tab, I delete the previous tab. I don’t know which tabview’s own animation entry is, so I won’t call lv_anim_set_ready_cb. Can you give me sample code? ,

As LV_EVENT_VALUE_CHANGE is fired when the snapping starts and there is no event when the tab is really loaded you need to apply a trick:

void ready_cb(lv_anim_t * a)

void event_cb(lv_obj_t * obj, lv_event_t e)
        lv_tabview_ext_t * ext = lv_obj_get_ext_attr(obj);
        lv_obj_t * scrl = lv_page_get_scrl(ext->content);
        lv_anim_t * a = lv_anim_get(scrl, lv_obj_set_x);
        if(a) {
            lv_anim_set_ready_cb(a, ready_cb);

    /*Create a Tab view object*/
    lv_obj_t *tabview;
    tabview = lv_tabview_create(lv_scr_act(), NULL);
    lv_obj_set_event_cb(tabview, event_cb);

Hi, I would like to come back to this post.

Could you please provide a code example on how this works in lvgl 8?
I’m using lvgl for the ESP32 and would need a callback after the slide animation of the tab finished.
I tried my best, but most of the functions used in this example are no longer available in lvgl 8.

Thanks in advance!

Found out how to do it in lvgl 8:

  if (lv_event_get_code(e) == LV_EVENT_VALUE_CHANGED) {
    lv_obj_t* tabview = lv_event_get_target(e);
    lv_obj_t* tabContainer = lv_tabview_get_content(tabview);
    lv_anim_t* anim = lv_anim_get(tabContainer, NULL);
    if(anim) {
      lv_anim_set_ready_cb(anim, ready_cb);

For a detailed code example, please also see