Java 调用ViewPager上的notifyDataSetChanged';s适配器停止平滑滚动
正如您在下面看到的,我有一个适配器Java 调用ViewPager上的notifyDataSetChanged';s适配器停止平滑滚动,java,android,Java,Android,正如您在下面看到的,我有一个适配器soundPagerTopAdapter用于ViewPager,它显示ArrayList sounds soundPagerAdapter = new SoundPagerAdapter(sounds); binding.myViewPager.setAdapter(soundPagerAdapter); 然后,当页面更改时(我通过ViewPager.OnPag
soundPagerTopAdapter
用于ViewPager
,它显示ArrayList sounds
soundPagerAdapter = new SoundPagerAdapter(sounds);
binding.myViewPager.setAdapter(soundPagerAdapter);
然后,当页面更改时(我通过ViewPager.OnPageChangeListener观看),我清除声音
数组列表并告诉适配器:
sounds.clear();
soundPagerAdapter.notifyDataSetChanged();
然后,问题是调用notifyDataSetChanged
会使滚动停止平滑。它冻结了一点
我有什么选择?我希望滚动顺利进行,但我还需要在滚动开始后立即更改适配器中的一项
我想不出一种方法来更新ViewPager
中的视图,而不调用notifyDataSetChanged