7

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);

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.

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.

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.

enter image description here

Any ideas on this?

Thanks

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

This issue looks to be the same as:

ViewPager with Google Maps API v2: mysterious black view

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

Community
  • 1
  • 1
user1219278
  • 1,859
  • 5
  • 22
  • 27
  • I have a similar problem: http://stackoverflow.com/questions/14419521/moving-mapfragment-surfaceview-causes-black-background-flickering. Posted a video showing how it looks there. Btw, what device are you testing on? – Michał Klimczak Jan 19 '13 at 22:39
  • Range of devices - HTC wildfire, Galaxy Nexus, Nexus S - behaves similarly on all of them, some worse than others (HTC Wildfire just goes completely black) – user291701 Jan 24 '13 at 22:42
  • Hey buddy as far as I get you have cteated controller like here https://www.cocoacontrols.com/controls/slparallaxcontroller. Do you know where can I find it. – fish40 Apr 29 '14 at 11:03

1 Answers1

1

Put this in your manifest if your targeting API 13>

<application android:hardwareAccelerated="true"/>
MoMo
  • 186
  • 1
  • 3
  • 15