Search code examples
androidandroid-fragmentsandroid-viewpagerfullscreentap

How can I show a ViewPager in fullscreen mode?


By having an activity which contains a ViewPager inside of it, is it possible to set that ViewPager fullscreen (on/false) when it is touched by a single tap?

enter image description here

If not, I am going to start a new activity in fullscreen containing another instance of the same ViewPager and manually sincronize both ViewPagers CurrentItem which will require more memory and more objects to be instantiated.

What would be the best approach to implement this feature?


Solution

  • David Neto's suggestion is good.

    But: You don't need to set the Layout width and heigth of all other Views to to 0.

    What you need to do:

    • Set the Visibility of all other Views to View.GONE, which is much easier

    If your ViewPager has "match_parent" properties for width and height, than thats it. If not, set them to "match_parent".