相关疑难解决方法(0)

除非您触摸mapview,否则不会加载Android MapView

我在我的android应用程序中添加了一个mapview.我在清单中使用了正确的设置,现在我遇到了问题.当我去我有地图的地方时,它只显示画布而不显示地图.如果我触摸它只开始加载.即使这样它也没有完全加载.它只加载到一定的水平.如果我继续触摸屏幕,它会不断加载.但即使这样我也无法放大或缩小,甚至无法移动地图.这有解决方案吗?我做错了什么吗?

我的守则

            MapView mapView;
            GoogleMap map;





             mapView = (MapView)view.findViewById(R.id.map);
             Bundle savedInstanceState = null;
            mapView.onCreate(savedInstanceState);

                // Gets to GoogleMap from the MapView and does initialization stuff
                map = mapView.getMap();
                map.getUiSettings().setMyLocationButtonEnabled(false);
                map.setMyLocationEnabled(true);

                MapsInitializer.initialize(activity);

                double lat;
                double lon;

                lat = Double.parseDouble(theaterDetail.getLatitude());
                lon = Double.parseDouble(theaterDetail.getLongitude());

                // Updates the location and zoom of the MapView
                map.addMarker(new MarkerOptions().position(
                        new LatLng(lat, lon)).title(theaterDetail.getAddress()));

                final LatLng THEATER_POSITION = new LatLng(lat, lon);

                CameraPosition cameraPosition = new CameraPosition.Builder()
                        .target(THEATER_POSITION) // Sets the center of the map to
                                                    // THEATER_POSITION
                        .zoom(10) // …
Run Code Online (Sandbox Code Playgroud)

android google-maps android-mapview

10
推荐指数
1
解决办法
5014
查看次数

标签 统计

android ×1

android-mapview ×1

google-maps ×1