2015-04-05 133 views

回答

1
@Bind(R.id.pager) ViewPager mViewPager; 
@Bind(R.id.tabs) SlidingTabLayout tabs; 
... 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_team_details); 
    ButterKnife.bind(this); 

    //get this value from savedInstanceState 
    int tabThatNeedsToBeSelected = 3; 

    myFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(),params); 
    mViewPager.setAdapter(myFragmentPagerAdapter); 
    tabs.setViewPager(mViewPager); 
    mViewPager.setCurrentItem(tabThatNeedsToBeSelected); 
} 
相關問題