點資料結構

點資料結構

拖曳標記觸發事件,於拖曳標記時觸發,拖曳標記觸發事件程式範例說明如下:

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

AddMapView = (RelativeLayout)findViewById(R.id.AddMapView);

try {

_MapView = new TGOnlineMap(this);

 

_MapView.setBackgroundColor(Color.rgb(165,191,221));

AddMapView.addView(_MapView);

_MapView.setOnInfoWindowClickListener(this);

_MapView.setOnMarkerClickListener(this);

_MapView.setOnMarkerDragListener(this);

 

TGMarker NoMove = _MapView.addMarker(new TGMarkerOptions()

.position(new TGLatLng(24.4,120.0))  //點資料結構坐標用WGS84

.title("title:Marker1")

.snippet("snippet:Marker1")

.draggable(false)

.icon(TGBitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));

 

TGMarker canMove = _MapView.addMarker(new TGMarkerOptions()

.position(new TGLatLng(23.4,121.0))

.title("title:canMove")

.snippet("snippet:canMove")

.draggable(true)

.icon(TGBitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));

} catch (TGRuntimeRemoteException e) {

e.printStackTrace();

}

}

 

回到上方