訊息視窗內容設定

訊息視窗內容設定

資訊視窗內容設定,範例為點擊地圖標記點進行訊息視窗設定顯示,程式範例說明如下:

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);

 

//設定Marker

TGMarker NoMove = _MapView.addMarker(new TGMarkerOptions()

.position(new TGLatLng(24.4,120.0))

.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();

}

}

回到上方