使用ViewPager做轮播图时,发生如下异常:
The specified child already has a parent. You must call removeView() on the child's parent first.
解决办法很简单:
在Adapter中的
public void destroyItem(ViewGroup container, int position, Object object) {…} 方法中
使用 container.removeView((View) object);
而不能使用 container.removeViewAt(position)