其他分享
首页 > 其他分享> > The application‘s PagerAdapter changed the adapter‘s contents without calling PagerAdapter

The application‘s PagerAdapter changed the adapter‘s contents without calling PagerAdapter

作者:互联网

The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 6, found: 0
 

最近程序碰到这个报错,记录一下

问题在adapter 中,

override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
    container.removeView(`object` as View)
}

要写成container.removeView(`object` as View)

而不是 container.removeView(views.get(position))

标签:object,container,adapter,changed,removeView,PagerAdapter,contents
来源: https://blog.csdn.net/LoadHappy/article/details/121994010