TabLayout scrolls to unkown position after calling notifyDataSetChanged on PagerAdapter

后端 未结 5 1189
死守一世寂寞
死守一世寂寞 2021-02-14 19:23

I have sample project with TabLayout and PagerAdapter. Strange things happens with TabLayout when I call pagerAdapter.notifyDataSetChanged();

5条回答
  •  误落风尘
    2021-02-14 19:54

    You can call:

    setupWithViewPager(@Nullable final ViewPager viewPager, boolean autoRefresh)
    

    and set param autoRefresh to false.

    See also: TabLayout(ViewPager,boolean)

提交回复
热议问题