新gms.maps.MapView呈现滞后一点在ListView的时候?时候、maps、gms、ListView

2023-09-05 03:20:48 作者:奈何橋丶等迩

我试图把新的MapView的实例在ListView。新的图形页面之中:

I'm trying to put an instance of the new MapView in a ListView. New mapview being:

com.google.android.gms.maps.MapView

我谈到的所有交互关闭,并设定一个固定高度的看法:

I'm turning all interactions off, and setting a fixed height for the view:

GoogleMapOptions options = new GoogleMapOptions();
    options.mapType(GoogleMap.MAP_TYPE_NORMAL);
    options.compassEnabled(false);
    options.rotateGesturesEnabled(false);
    options.scrollGesturesEnabled(false);
    options.tiltGesturesEnabled(false);
    options.zoomControlsEnabled(false);
    options.zoomGesturesEnabled(false);

mMapView = new MapView(getActivity(), options);
mMapView.setLayoutParams(new AbsListView.LayoutParams(
    AbsListView.LayoutParams.MATCH_PARENT,
    200));
mMapView.setEnabled(false);
mMapView.setFocusable(false);
getListView().addHeaderView(mMapView);
getListView().addAdapter(simpleArrayAdapter);

这工作,但如果我快速滚动列表视图,它看起来像的MapView呈现滞后一点,所以你可以看到滚动的方向黑色像素的面积小。

This works, but if I scroll the listview quickly, it looks like the mapview rendering lags a bit, so you can see a small area of black pixels in the direction of scrolling.

它几乎好像这是某种形式的同步问题,因为我猜使用OpenGL的MapView足够快的响应我的卷轴来呈现。此外,旧的MapView + MapActivity将在相同的设置进行精细的。

It almost seems as if this is some kind of synchronization issue, as I'm guessing the mapview with opengl is fast enough to render in response to my scrolls. Also, the old MapView+MapActivity would perform fine in the same setup.

下面是当你快速滚动显示的差距画面。经过很短的时间,的MapView将赶上并再次渲染确定。

Below is a picture of the gap that appears when you scroll quickly. After a short time, the mapview will catch up and render ok again.

对此有何想法?

感谢

-----更新---------

----- Update ---------

此问题看起来是一样的:

This issue looks to be the same as:

ViewPager与谷歌地图API第2版:神秘的黑色视图

我无法得到修复记录有在此设置工作,虽然。

I could not get the fix documented there to work in this setup, though.

推荐答案

在将这个您的清单,如果你的目标API 13>

Put this in your manifest if your targeting API 13>

<application android:hardwareAccelerated="true"/>