简体   繁体   中英

Android Maps api v2 strange phenomenon

I've integrated a map fragment (Android Maps Api V2) in my app, and this works fine as shown in this pic :

在此输入图像描述

but when soft keybord is shown, map is slided to top and becomes blank as shown in the following pic :

在此输入图像描述

I also must say that this phenomenon accurs on a galaxy S (2.3.3) not in galaxy SIII and even not in galaxy Y, is it a performance problem or bug or am I missing anything ?

Please help if you ever have encountred this problem..

Thanks.

You could try this:

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);
   }
  }
 }
 // ...
};

Instead of using the mapFragment provided by google, use this one. It fixed the same issue for me, but it was doing it on a sliding menu.

Credits to: https://github.com/jfeinstein10/SlidingMenu/issues/168#issuecomment-11834105

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM