我有一个问题:在第一页加载时,在tabhost里面查看分页器和片段,自动将位置值设置为1
我的代码在这里
package com.astuetz.viewpager.extensions.sample;
import java.util.List;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;
public class MyPageAdapter extends FragmentPagerAdapter {
private List<Fragment> fragments;
private final String[] TITLES = { "shamboooooliting","Categories", "Home", "Top Paid", "Top Free", "Top Grossing" };
public MyPageAdapter(FragmentManager fm, List<Fragment> fragments) {
super(fm);
this.fragments = fragments;
}
@Override
public Fragment getItem(int position) {
Log.d(">>>>>>>>>>>position"," "+position+" "+this.fragments.get(position).toString());
return this.fragments.get(position);
}
@Override
public CharSequence getPageTitle(int position) {
Log.d(">>>>>>>>>>>positionzzzzzzzz"," "+position);
return TITLES[position];
}
@Override
public int getCount() {
return this.fragments.size();
}
}
我跟踪位置及其设置为0,当第一页加载时,它自动设置为1
当它设置为1时,加载第二个活动 但我不希望位置设置为1 我想在下一页然后加载活动
时将其设置为1