Android Google地图未在活动小布局中加载

Android Google地图未在活动小布局中加载,android,google-maps,map,android-activity,android-mapview,Android,Google Maps,Map,Android Activity,Android Mapview,在我的应用程序中,我在底部的活动中使用地图视图。但地图没有正确加载。在单击地图2-3次后,它显示清晰的地图。当相同的地图在全视图中加载时,它加载清晰。 解决这个问题的办法是什么 截图为- <com.google.android.gms.maps.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="

在我的应用程序中,我在底部的活动中使用地图视图。但地图没有正确加载。在单击地图2-3次后,它显示清晰的地图。当相同的地图在全视图中加载时,它加载清晰。 解决这个问题的办法是什么

截图为-

<com.google.android.gms.maps.MapView
            android:id="@+id/map"
            android:layout_width="fill_parent"
            android:layout_height="200dp"
            android:layout_margin="10dp" />

我遇到了一个非常类似的问题,我坚持使用MapView,尽管它现在已经被弃用了。 这是我的问题,也是我的答案:

您需要实现以下方法: 恢复原状;暂停;自然灾害;在线记忆


希望能有所帮助。

地图加载不正确是什么意思?打开活动后,地图视图上会显示方形框。点击地图上的2-3次后,它会加载地图发布您的所有代码PPPLZZ,或者您可以在mMapView.onResume上恢复地图视图;然后在mMapView上暂停;我不明白你的意思。我在活动中使用这个链接虽然这个链接可以回答这个问题,但最好在这里包含答案的基本部分,并提供链接供参考。如果链接页面发生更改,则仅链接的答案可能无效。
try {
            MapsInitializer.initialize(getApplicationContext());
        } catch (GooglePlayServicesNotAvailableException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        switch (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()) )
        {
        case ConnectionResult.SUCCESS:

            mapView = (MapView)findViewById(R.id.map);
            mapView.onCreate(savedInstanceState);
            // Gets to GoogleMap from the MapView and does initialization stuff
            if(mapView!=null)
            {
                map = mapView.getMap();
                map.getUiSettings().setMyLocationButtonEnabled(false);
                map.setMyLocationEnabled(true);
                CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(locationPosition, 10);
                map.animateCamera(cameraUpdate);
                map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
            }
            break;
        case ConnectionResult.SERVICE_MISSING: 

            break;
        case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED: 

            break;
        default: Toast.makeText(getApplicationContext(), GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()), Toast.LENGTH_SHORT).show();
        }

        CameraPosition cameraPosition = new CameraPosition.Builder()
        .target(locationPosition).zoom(10).bearing(0) // Sets the orientation of the camera to east
        .tilt(70)    // Sets the tilt of the camera to 30 degrees
        .build();    // Creates a CameraPosition from the builder
        map.setBuildingsEnabled(true);
        map.setMyLocationEnabled(true);
        map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
        map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
        map.addMarker(new MarkerOptions() .position(locationPosition).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_marker)));