Android PagerAdapter destroyItem(), caches for a while when using fragments

I'm using Android-support-v4

I have a PagerAdapter that displays a list fragment in each page.

I noticed that when swiping pages, each page displays the fragment of the previous page first (for 1 second) then displays the correct fragment of the given position.

I solved this caching issue by removing the call to

super.destroyItem(container, position, object);

in the public void destroyItem(ViewGroup container, int position, Object object) method.

I can't find an explanation for this, can anybody explain what happened ?

thanks


ok, I got it in the destroyItem method, I removed the call to the super super.destroyItem(container, position, object);

really don't know an explanation, but I believe cause the parent class removes the views from the page at the given index, in my case it's supposed to remove FRAGMENTS not VIEWS.

链接地址: http://www.djcxy.com/p/74938.html

上一篇: 滚球在Android中使用Accelerometer

下一篇: Android PagerAdapter destroyItem(),在使用片段时缓存一段时间