MapFragment causes flickering in ViewPager

北战南征 提交于 2019-12-04 18:36:47

I had the same issue with my project's (rather complex) structure: HostActivity -> HostFragment with ViewPager -> ListView with embedded MapFragment.

I tried to solve this issue following this gmaps-api-issues thread but with no luck (though I recommend reading it as it provides some background on the issue itself).

Then I stumbled upon this blog post and it did the trick for me:

public void onCreate(Bundle savedInstanceState) {
    ...
    ViewPager pager = (ViewPager)findViewById(R.id.pager);
    ...
    pager.setAdapter(adapter);
    pager.requestTransparentRegion(pager); // This line solved the problem for me
    ...
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!