I\'m trying to integrate Google Maps Android API v2 into my Android Application. I\'m placing the Google Map in the middle of my layout. It works great when the layout is able t
I was able to adapt the above for the same issue in a Viewpager by overriding onPageScrolled
in the FragmentPagerAdapter:
@Override
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
if ((position == 0 && positionOffsetPixels > 0) ||
(position == 1 && positionOffsetPixels == 0)) {
MyFragment blackedOutFragment = (MyFragment) getSupportFragmentManager()
.findFragmentByTag("android:switcher:" + R.id.pager + ":1");
if (blackedOutFragment != null) {
blackedOutFragment.getView().setVisibility(View.GONE);
blackedOutFragment.getView().setVisibility(View.VISIBLE);
}
}
}
Where position 0
in the Viewpager is a Fragment holding a MapFragment and position 1
is the Fragment getting blacked out after the scroll.