如何繪制從當前位置到目的地(緯度和經度)的路線方向,我的代碼如下:import android.os.Bundle;import com.actionbarsherlock.app.SherlockActivity;import com.google.android.gms.maps.CameraUpdateFactory;import com.google.android.gms.maps.GoogleMap;import com.google.android.gms.maps.MapFragment;import com.google.android.gms.maps.model.LatLng;import com.google.android.gms.maps.model.MarkerOptions;public class DetailMapActivity extends SherlockActivity { private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_detail_map); LatLng TO_DESTINATION = new LatLng(-6.33438, 106.74316); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); map.setMyLocationEnabled(true); map.addMarker(new MarkerOptions().position(TO_DESTINATION).title("Destination Title") .snippet("Destination Description")); map.moveCamera(CameraUpdateFactory.newLatLngZoom(TO_LOCATION, 40)); map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); }}我想通過提供商網絡或GPS從當前位置繪制,然后通過開車到目的地來繪制路線。我正在使用android Google API V2。謝謝你的幫助。
Android:如何繪制路線指示Google Maps API V2從當前位置到目的地
慕無忌1623718
2019-10-08 10:15:01