I have integrated the new google maps api v2 fragment in a view pager. When scrolling from the map fragment, a black view overlaps the adjacent fragments. Someone has solved?
Edit: screenshot
public static class PagerAdapter extends FragmentPagerAdapter{ public PagerAdapter(FragmentManager fm) { super(fm); } @Override public int getCount() { return NUM_ITEMS; } @Override public Fragment getItem(int position) { Fragment pageFragment; switch (position) { case 0: pageFragment = new TabAFragment(); break; case 1: pageFragment = new TabBFragment(); break; case 2: pageFragment = SupportMapFragment.newInstance(); break; default: pageFragment = null; break; } return pageFragment; } }
I was able to stop the black surface being left behind after transition by placing another view with a transparent background on top of the ViewPager
inside a FrameLayout
:
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v4.view.ViewPager android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" > </android.support.v4.view.ViewPager> <!-- hack to fix ugly black artefact with maps v2 --> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/transparent" /> </FrameLayout>
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