Android Drawer Example, how to implement Google Map Fragment

后端 未结 2 1140
夕颜
夕颜 2020-12-20 02:20

Actually I am trying to implement Google Map on Android Drawer example, basically I would like to show a map by selecting the first menu item. All the provided examples are

2条回答
  •  自闭症患者
    2020-12-20 03:00

    Update your Location Fragment XML as following :

    
    
    

    Implement in your fragment the OnMapReadyCallback interface, and write the code for configuring your Map in onMapReady(GoogleMap map) method, for example :

    public void onMapReady(GoogleMap map) {
        googleMap.addMarker(new MarkerOptions()
                 .position(new LatLng(0, 0))
                 .title("Marker"));
    
        googleMap.setMyLocationEnabled(true);
        googleMap.animateCamera(CameraUpdateFactory.zoomTo(17.0f) );
    }
    

    I hope it will be helpful for you !

提交回复
热议问题