Add / Delete pages to ViewPager dynamically

前端 未结 9 1113
囚心锁ツ
囚心锁ツ 2021-01-29 23:17

I would like to add or delete pages from my view pager dynamically. Is that possible?

9条回答
  •  梦如初夏
    2021-01-30 00:13

    First:override the pagerAdapter method "getItemPosition"

    @Override
    public int getItemPosition(Object object) {
            return POSITION_NONE;
        }
    }
    

    Second:remove the data bind with the adapter.and call adapter.notifydatachanged

提交回复
热议问题