EDIT: See my answer below-->
I am wanting to have a view that when swiped to the right, the listView is shown. Very much similar to what is implemen
With a little Trick, the behavior can be achieved with the ScrollView-Behavior inside the ViewPager. If you only want to restrict the area of the most left fragment, you can restrict the scroll limits of the ScrollView.
In your case: in the onPageChangeListener of the ViewPager do something like that:
@Override
public void onPageScrollStateChanged(int arg0) {
restrictLeftScroll();
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
restrictLeftScroll();
}
@Override
public void onPageSelected(int arg0) {
}
private void restrictLeftScroll() {
if (display != null) {
/* get display size */
Point size = new Point();
display.getSize(size);
/* get desired Width of left fragment */
int fragmentWidth = getResources().getDimensionPixelSize(R.dimen.category_fragment_width);
if (mViewPager.getScrollX() < size.x - fragmentWidth) {
mViewPager.scrollTo(size.x - fragmentWidth, mViewPager.getScrollY());
}
}
}
This piece of code worked for me without problems. ;)