I'm building a FragmentPagerAdapter (The one with the small icons) which I want;
What would be the best way to achieve this?
This is a visual representation:
This is the code of the FragmentPagerAdapter:
public class NavigationPagerAdapter extends FragmentPagerAdapter {
public NavigationPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return NavigationFragment.newInstance(position);
}
@Override
public int getCount() {
return stores.size();
}
@Override
public CharSequence getPageTitle(int position) {
return null;
}
@Override
public float getPageWidth(int position) {
return 0.2f;
}
}
I hope I understood this right. Try to add the following configuration to your `ViewPager.
pager.setOffScreenPageLimit(4);
pager.setClipToPadding(false);
pager.setPageMargin(-500);
pager.setHorizontalFadingEdgeEnabled(true);
pager.setFadingEdgeLength(20);
Feel free to customize the values and get your desired effect