androidgoogle-maps-android-api-2nexus-onesupportmapfragment

SupportMapFragment in Nexus One


I'm having some problems mixing the old Google Nexus One with the new SupportMapFragment.

In a particular landscape view I have an HorizontalScrollView with a map and some info in a way you have to scroll in order to actually see the info.

The problem is that scrolling makes (somehow I can't understand right now) the SupportMapFragment's background visible (which seems to be black by default) while actually scrolling the whole view

Picture to show what I mean.

Behaviour demo

Altough not the same exact issue, there is a similar, reported bug, about it in gmaps-api-issues


So, what I've tested so far:

Setting this code before calling my map:

GoogleMapOptions op = new GoogleMapOptions();
op.zOrderOnTop(true);
SupportMapFragment.newInstance(op);

So I ran out of ideas. I've successfully tested same exact code in:

EDIT: An interesting thing is, taking the screenshot made me realize that it was imposible to capture my specific case. When the screenshot was taken, the error only could be reproduced by changing to portrait and landscape again.

Any ideas? Did I missed anything obvious?

Thanks in advance for your comments.


Solution

  • I had a very similar issue but when i was adding the SlidingMenu library and i fixed it by using the hack on this comment

    public class MyMapFragment extends SupportMapFragment() {
    
       @Override
       public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
           View view = super.onCreateView(inflater, container, savedInstanceState);
           setMapTransparent((ViewGroup) view);
           return view;
       };
    
       private void setMapTransparent(ViewGroup group) {
           int childCount = group.getChildCount();
           for (int i = 0; i < childCount; i++) {
           View child = group.getChildAt(i);
           if (child instanceof ViewGroup) {
               setMapTransparent((ViewGroup) child);
           } else if (child instanceof SurfaceView) {
               child.setBackgroundColor(0x00000000);
           }
       }
     }