使用 開啟viewpager所有3個activity就啟動了,如果3個activity都要向服務端請求數據,但又不一定會被訪問到,不是很浪費,有沒有其他方案
View one = getViews(A.class, "a");
View two = getViews(B.class, "a");
View three = getViews(C.class, "a");
listViews.add(one);
listViews.add(two);
listViews.add(three);
mPager.setAdapter(new MyPagerAdapter(listViews));
mPager.setCurrentItem(0);
mPager.setOnPageChangeListener(new MyOnPageChangeListener());
public View getViews(Class<?> cls,String pageid){
return getLocalActivityManager().startActivity(pageid, new Intent(MainActivity.this,cls).
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
}
幫我看一下應該怎麼修改!!
看看能不能用ActivityGroup和手勢去實現左右滑動的效果,又可以做到惰性加載