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?
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?
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:
View.GONE
, which is much easierIf your ViewPager has "match_parent" properties for width and height, than thats it. If not, set them to "match_parent".
Maybe you could set an onClickListener on 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, not sure if it's the most correct way to do it but I think it will work. Also, this is pseudo code, just to explain the idea, it's not proper Java code (obviously) :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With