MapView sch_map = (MapView) dialog.findViewById(R.id.schedule_map);
sch_map.onCreate(savedInstanceState);
sch_map.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final GoogleMap googleMap) {
LatLng sydney = new LatLng(-33.867, 151.206);
googleMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
});
Run Code Online (Sandbox Code Playgroud)
我正在加载对话框中的地图,因为地图视图是非常慢的地图正在加载但是花了很多时间这是我的布局,我在其中定义mapview.
<com.google.android.gms.maps.MapView
android:layout_width="match_parent"
android:layout_height="300dp"
map:uiRotateGestures="true"
map:uiScrollGestures="true"
map:uiTiltGestures="true"
map:uiZoomControls="true"
map:uiZoomGestures="true"
map:liteMode="true"
android:id="@+id/schedule_map" />
Run Code Online (Sandbox Code Playgroud)