I was able to successfully implement PagerSlidingTabStrip with my app.
But my application requires a tab with Text And Icons.
Unfortunately, I am not able to do that.
public class Pager extends FragmentStatePagerAdapter implements PagerSlidingTabStrip.IconTabProvider {
private int tabIcons[] = {R.drawable.ic_explore, R.drawable.ic_nearby, R.drawable.ic_road_rescue};
private String tabTitles[] = new String[] { "Tab1", "Tab2", "Tab3" };
public Pager(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return new Explore();
case 1:
return new Nearby();
case 2:
return new RoadRescue();
}
return null;
}
@Override
public int getCount() {
return tabIcons.length;
}
@Override
public CharSequence getPageTitle(int position) {
return tabTitles[position];
}
@Override
public int getPageIconResId(int position) {
return tabIcons[position];
}
}
What seems to be wrong with my code? Thanks