我有标签 viewpagerindicator 错误,如果返回或滑动到上一个片段总是重新加载...
这是我的代码片段
package com.droidersuin.project.viewpagerindicator;
import com.droidersuin.project.app.ContentActivity;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
public class ViewAdapter extends FragmentPagerAdapter{
private Context _context;
String[] page_titles;
public ViewAdapter(Context context, FragmentManager fm, String[] page_title){
super(fm);
_context = context;
this.page_titles = page_title;
}
@Override
public Fragment getItem(int position) {
// TODO Auto-generated method stub
Fragment f = new Fragment();
switch(position){
case 0:
f = ContentActivity.newInstance(_context);
break;
case 1:
f = ContentActivity.newInstance(_context);
break;
case 2:
f = ContentActivity.newInstance(_context);
break;
}
return f;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return page_titles.length;
}
public CharSequence getPageTitle(int position) {
return page_titles[position];
}
}
如果我从片段 0 滑动到片段索引 1 并向后滑动到索引 0,总是重新加载内容,我想让如果向后滑动到前一个片段不再重新加载?如何
谢谢...对不起我的英语..