I have a android application which try to implement android PagerTabStrip on ViewPager.I have three tab 1) Tab1 2)Tab2 and 3) Tab3. When Tab1 are selected then only show Tab1>>Tab2(pic_01).When Tab2 selected then it show Tab1>>Tab2>>Tab3(pic_02). When Tab3 selected then it show Tab2>>Tab3(pic_03).But I want ,all the time 3 tab will be visible at the same time. Such as when Tab1 selected then it will Tab3>>>Tab1>>Tab2. Same as when Tab2 selected then it will be ab1>>Tab2>>Tab3 .and when Tab3 slected then it will be Tab2>>Tab3>>Tab1.My trying cod are bellow which i implement.
viewPager = (ViewPager) findViewById(R.id.pager);
mPagerTabStrip = (PagerTabStrip)findViewById(R.id.PagerTab);
mPagerTabStrip.setScrollContainer(true);
// Set the ViewPagerAdapter into ViewPager
viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));
ViewPagerAdapter is the FragmentPagerAdapter class.
public class ViewPagerAdapter extends FragmentPagerAdapter {
final int PAGE_COUNT = 3;
// Tab Titles
private String tabtitles[] = new String[] { "Tab1", "Tab2", "Tab3" };
Context context;
public ViewPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getCount() {
return PAGE_COUNT;
}
@Override
public Fragment getItem(int position) {
Log.w("position", "are:"+position);
switch (position) {
// Open FragmentTab1.java
case 0:
FragmentTab1 fragmenttab1 = new FragmentTab1();
return fragmenttab1;
// Open FragmentTab2.java
case 1:
FragmentTab2 fragmenttab2 = new FragmentTab2();
return fragmenttab2;
// Open FragmentTab3.java
case 2:
FragmentTab3 fragmenttab3 = new FragmentTab3();
return fragmenttab3;
}
return null;
}
@Override
public CharSequence getPageTitle(int position) {
return tabtitles[position];
}
}
Actually i want all the time those three tab will be visible same as pic_02.Is it possible?Please help to me.(Thanks to all)