如何爲每個標記添加標記,並且標記始終與標記一起?因爲地圖上有許多標記(車輛),因此爲標記添加一個標記,以便用戶不需要點擊標記並知道標記(車輛)的許可證號碼。如何在android Google Map中添加標記標記?
回答
嘗試此,
marker.showInfoWindow();
我希望標記始終可見並與標記一起顯示,用戶無需點擊標記。 –
Use the Marker Class
,並且是指該鏈接https://developers.google.com/maps/documentation/android/marker
放置在地圖的表面上的特定點的圖標。標記圖標是針對設備的屏幕而非地圖表面繪製的;即由於地圖旋轉,傾斜或縮放而不一定會改變方位。
的標記具有以下屬性:
Anchor
將放置在標記的經緯度位置的圖像上的點。默認爲圖像左側和圖像底部的50%。
Position
標記在地圖上的位置的LatLng值。如果您想移動標記,您可以隨時更改此值。
標題
當用戶點擊該標記中顯示的有關信息窗口的文本字符串。您可以隨時更改此值。
Snippet
顯示在標題下方的其他文字。您可以隨時更改此值。
Icon
顯示標記的位圖。如果圖標未設置,則顯示默認圖標。您可以使用defaultMarker(float)指定默認圖標的替代顏色。創建標記後,您無法更改圖標。
Drag Status
如果要允許用戶拖動標記,請將此屬性設置爲true。您可以隨時更改此值。默認值是true。
Visibility
默認情況下,標記是可見的。要使標記不可見,請將此屬性設置爲false。您可以隨時更改此值。
GoogleMap map = ... // get a map.
// Add a marker at San Francisco.
Marker marker = map.addMarker(new MarkerOptions()
.position(new LatLng(37.7750, 122.4183))
.title("San Francisco")
.snippet("Population: 776733"));
我已經在地圖上生成了標記,我需要的是添加標記和標記。 –
這就是所謂的自定義信息窗口... –
看到這個可愛的教程http://androidfreakers.blogspot.in/2013/08/display-custom-info-window-with.html –
試試這個: 添加類代碼
private class CustomInfoWindowAdapter implements InfoWindowAdapter, IServerResponse, ServerParameterList {
private View view;
private String _spotId = "";
LinearLayout _mainlayout;
public CustomInfoWindowAdapter() {
view = getLayoutInflater().inflate(R.layout.custom_balloon_overlay,
null);
}
@Override
public View getInfoContents(Marker marker) {
if (CustomMap.this._marker != null
&& CustomMap.this._marker.isInfoWindowShown()) {
CustomMap.this._marker.hideInfoWindow();
CustomMap.this._marker.showInfoWindow();
}
return null;
}
@Override
public View getInfoWindow(final Marker marker) {
CustomMap.this._marker = marker;
String url = null;
// setup our fields
_title = (TextView) view.findViewById(R.id.balloon_item_title);
_snippet = (TextView) view.findViewById(R.id.balloon_item_snippet);
_mainlayout=(LinearLayout)view.findViewById(R.id.balloon_main_layout);
// IMPLEMENTING BALLOON DETAILS
ImageButton details = (ImageButton) view
.findViewById(R.id.balloon_details);
/*_storeIdTextView = (TextView) parent
.findViewById(R.id.balloon_storeId_custom);
_storeIdTextView.setVisibility(View.GONE);*/
if(marker.getTitle()!=null)
{
_title.setText(marker.getTitle());
}
/* if(marker.getSnippet()!=null)
{
_snippet.setText(marker.getSnippet());
}*/
return view;
}
@Override
public void serverResponse(String response, int processid) {
// TODO Auto-generated method stub
System.out.println("Response Custom"+response);
}
}
其中custom_balloon_overlay是你的佈局
並在地圖上使用它像:
mapView.setInfoWindowAdapter(new CustomInfoWindowAdapter());
如果工作請標記答案權利 – Prashant
- 1. Angularjs Google Map添加標記
- 2. android-google map v3從sql加載標記
- 3. 如何在Google Map中添加多個標記?
- 4. 如何在Google Maps API v3中將標記添加到標記
- 5. 如何從getJSON數組中添加Google Map標記?
- 6. 如何在Google Map上添加信息窗口和標記
- 7. Android:如何在google map API中將imageView設置爲標記android?
- 8. 如何在現有標記下添加Google地圖標記
- 9. Google Map API - 刪除標記
- 10. 在自定義標記中添加一個值Google Map V3
- 11. 在Rails中的Google Map上添加標記?
- 12. 如何從XML座標數據在Google Map上添加多個標記?
- 13. 如何在v2 google map中添加多個標記和疊加層?
- 14. 添加Google地圖標記
- 15. Google Map API標記圖標網址?
- 16. Android - 如何添加Google地圖標記標籤?
- 17. 如何在Android中將標記設置爲Google地圖標記?
- 18. 將地址標記添加到此Google Map API V3中?
- 19. 添加標記
- 20. Android,如何從Google Map V2中刪除所有標記?
- 21. 在react-google-map上動態添加標記
- 22. 如何使用Google map API v3爲標記添加文本標籤?
- 23. Google Map API V3:如何在CS中添加或顯示InfoWindow()到標記頁
- 24. Google map在繪製新標記時清除舊標記
- 25. Infowindow for Google Map中的圓形標記
- 26. Android Map v2標記泡泡
- 27. Google Map API v3 - 標記中心地圖
- 28. 在Google地圖v2 api上爲標記添加標識android
- 29. 如何在Google Maps API標記上添加自定義標題?
- 30. Jade - 如何在href標記中添加額外的href標記
嘗試添加該與標記一起的牌照。 – Prachi
@Vera我用紅色標出的形狀是一個許可證標籤。 –
然後添加一個佈局,它具有汽車的imagview作爲標記和licesnse標記。並將此佈局用作標記。製作自定義標記 – Prachi