2

This only happens on Android 2.x. If you put a GoogleMapFragment on a screen that scrolls when the software keyboard is shown, part of your other widgets will be overlaid with black rectangles.

black rectangles

This seems to be related with https://code.google.com/p/android/issues/detail?id=11676. As far as I know, the new V2 GoogleMap uses SurfaceView to draw, but we do not have access to the SurfaceView directly.

P.S. Actually this is a variation of Android's EditText is hidden when the virtual keyboard is shown and a SurfaceView is involved. I post this here to increase visibility, since this is a common Google Map V2 problem. If you think this should be a community question, please let me know or just change it.

Community
  • 1
  • 1
Randy Sugianto 'Yuku'
  • 71,383
  • 57
  • 178
  • 228

1 Answers1

2

You can traverse the view hierarchy and look for the view that is instance of SurfaceView. This worked for me.

If you are going to use the below code, call traverse() at the end of onCreate or any time the Google Map fragment has been added to your activity.

void traverse() {
    View root = findViewById(android.R.id.content);
    traverse(root, 0);
}

void traverse(View v, int depth) {
    if (v instanceof SurfaceView) {
        SurfaceView sv = (SurfaceView) v;
        sv.setBackgroundColor(Color.TRANSPARENT);
    }

    if (v instanceof ViewGroup) {
        ViewGroup vg = (ViewGroup) v;
        for (int i = 0, len = vg.getChildCount(); i < len; i++) {
            traverse(vg.getChildAt(i), depth+1);
        }
    }
}
Randy Sugianto 'Yuku'
  • 71,383
  • 57
  • 178
  • 228