Perhaps you can set onClickListener to the ViewPager to do something like this:
if flag == 0 { set the other Views surrounding the ViewPager layout_width and layout_height to 0dp; set the ViewPager layout_width and layout_height to 0dp AND layout_weight to 1; flag = 1; } elseif(flag == 1) { set other Views layout_width and layout_height to their normal values; set the ViewPager layout_width and layout_height to their normal values also; flag = 0; }
Maybe this helps, I'm not sure if this is the right way to do this, but I think it will work. Also, this is pseudo code, just to explain the idea, this is not the correct Java code (obviously) :)
source share