- 如何創建標記類的實例,但不將其添加到地圖中。
回答
您可以使用LazyMarker.java從Android Maps Extensions。
直到你打電話給它setVisible(true)
它不物理創建標記。
它完成了這項工作。謝謝。 – 2013-05-10 12:14:16
您可以通過設置visibility
到false
Marker marker = mMap.addMarker(new MarkerOptions()
.position(
new LatLng(arg0.latitude,
arg0.longitude))
.draggable(true).visible(false));
編輯
Marker m = new Marker(new z() {
@Override
public IBinder asBinder() {
return null;
}
@Override
public void showInfoWindow() throws RemoteException {
}
@Override
public void setVisible(boolean paramBoolean)
throws RemoteException {
}
@Override
public void setTitle(String paramString)
throws RemoteException {
}
@Override
public void setSnippet(String paramString)
throws RemoteException {
}
@Override
public void setPosition(LatLng paramLatLng)
throws RemoteException {
}
@Override
public void setDraggable(boolean paramBoolean)
throws RemoteException {
}
@Override
public void remove() throws RemoteException {
}
@Override
public boolean isVisible() throws RemoteException {
return false;
}
@Override
public boolean isInfoWindowShown() throws RemoteException {
return false;
}
@Override
public boolean isDraggable() throws RemoteException {
return false;
}
@Override
public void hideInfoWindow() throws RemoteException {
}
@Override
public int hashCodeRemote() throws RemoteException {
return 0;
}
@Override
public String getTitle() throws RemoteException {
return null;
}
@Override
public String getSnippet() throws RemoteException {
return null;
}
@Override
public LatLng getPosition() throws RemoteException {
return null;
}
@Override
public String getId() throws RemoteException {
return null;
}
@Override
public boolean g(z paramz) throws RemoteException {
return false;
}
});
,然後添加它,當你想這樣
做到這一點希望它可以幫助
這是一個選項,但仍然將標記實際添加到地圖中。我想知道是否有一種方法可以在不添加它的情況下創建它 - 比如Flex Maps API。 – 2013-05-10 11:47:09
我認爲只能通過使用'com.google.android.gms.internal.z'創建一個新的'Marker'對象來完成'Marker m = new Marker(new z()/ *完全匿名的內部類* /)' – 2013-05-10 12:02:24
@ AnujMathur_07標記構造函數不應該供開發人員使用,嘗試使用它不是好事。請參閱[此gmaps問題](http://code.google.com/p/gmaps-api-issues/issues/detail?id=5281)。 – 2013-05-10 12:07:57
- 1. 添加標記到一個HashMap,而不將其添加到地圖
- 2. 將標記添加到BlackBerry地圖
- 3. 將現有標記添加到地圖
- 4. Sencha Touch - 將標記添加到地圖
- 5. 將標記添加到Google地圖
- 6. 通過地址而不是座標添加Google地圖標記?
- 7. 如何將標記添加到用Raphael.js創建的圓環圖?
- 8. 地圖初始化後將標記添加到谷歌地圖
- 9. 如何將自定義標記圖標添加到Google地圖?
- 10. 將標記添加到Google地圖不起作用
- 11. 添加標記ammap地圖
- 12. 添加Google地圖標記
- 13. 將標記添加到谷歌地球
- 14. 標記未添加到我的地圖
- 15. 輪EGDE添加到地圖標記
- 16. 添加ID到谷歌地圖標記
- 17. 添加動態標記到地圖
- 18. 在創建地圖後向Google Maps v3添加標記
- 19. jVectorMap在地圖創建後添加更多標記
- 20. 如何使用XY座標將標記添加到ArcGIS地圖
- 21. 如何使用JSON座標將標記添加到OPENLAYERS地圖?
- 22. 方法創建其他類的實例,並將其添加到地圖
- 23. 使用Leaflet.js創建自定義標記在地圖上添加多個標記
- 24. 將地圖標記添加到HTML5中的平面圖
- 25. 如何將onfocus函數添加到js而不是將其添加到textarea標記中
- 26. 將刷新標記添加到視圖
- 27. ReactNative添加標記到地圖中的異常標記,預計
- 28. 使用gmap3添加安全點和圖標大小以將地圖標記添加到地圖中
- 29. 將位置標記添加到JS v3 Google地圖
- 30. 如何將單個標記添加到Google地圖v3?
對於我創建的應用程序而言,這不僅僅是至關重要的。 – 2013-05-10 11:43:15