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))