I am trying to achieve this in a ViewPager
The first fragment (blue) is displayed and the beginning of the next fragment must be displayed as well, so the user under
viewpager.setClipToPadding(false);
viewpager.setPageMargin(-50);
Try using a negative value for ViewPager.setPageMargin.
You can try adding this to your PageAdapter:
public float getPageWidth(int position) {
if (position == 0 || position == 2) {
return 0.8f;
}
return 1f;
}
@Override
public float getPageWidth(int position) {
return 0.9f;
}
Use this, this will work perfectly and make sure that your class extended to PagerAdapter
This function worked better than the answer marked as correct (for me anyway).
@Override
public float getPageWidth(int position) {
return 0.9f;
}
Just place it in your custom PagerAdapter
class.