2015年1月5日 星期一

android viewpager setting destroy


in revision 4 of the Support Package, a method was added to ViewPager which allows you to specify the number of offscreen pages to use, rather than the default which is 1.
In your case, you want to specify 2, so that when you are on the third page, the first one is not destroyed, and vice-versa.
mViewPager = (ViewPager)findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(2);

沒有留言:

張貼留言