2017-02-12 198 views

回答

0

,如果這是在Android的工作室,然後繼承人你如何在地圖上放置一個標記,然後修改它以獲取infowindow

mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() { 
     @Override 
     public void onMapClick(LatLng point) { 
     try { 
       //place marker where user just clicked 
       marker = mMap.addMarker(new MarkerOptions().position(point)); 
       LatLng latLng = marker.getPosition(); 
       double latitude = latLng.latitude; 
       double longitude = latLng.longitude; 

       Geocoder geocoder; 
       addresses = null; 
       geocoder = new Geocoder(getBaseContext(), Locale.getDefault()); 


       addresses = geocoder.getFromLocation(latitude, longitude, 1); 
      } catch (IOException e) { 
       e.printStackTrace(); 
      } 
     } 
    }