2016-02-22 20 views
-1

如何添加一個別針(不是標記)到谷歌地圖在Android?
我知道如何添加標記,像這樣:

添加別針(不是標記)到谷歌地圖Android

map.addMarker(new MarkerOptions() 
       .position(new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude())) 
       .title(getString(R.string.start_location_marker))); 



但我想一個引腳,而不是一個標記。
銷看起來是這樣的:
pin

的標記看起來是這樣的:
marker

+0

加入這一行標誌'.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin)));'.. – Bharatesh

回答

0

設置PIN碼圖像標記它被稱爲自定義標記

@Override 
public void onMapReady(GoogleMap googleMap) { 

    BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.pin); 
    LatLng latLng = new LatLng(21.4225, 39.8262); 
    googleMap.addMarker(new MarkerOptions().position(latLng).title("Mecca").icon(icon)).showInfoWindow(); 
    googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15)); 
}