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)
{
printf("Ready\n");
}
void event_cb(lv_obj_t * obj, lv_event_t e)
{
if(e == LV_EVENT_VALUE_CHANGED) {
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);