set anchor for a PictureMarkerSymbol in arcgis android sdk

المشرف العام

Administrator
طاقم الإدارة
I am trying to create a PictureMarkerSymbolin arcgis android, however I found that the marker use the center of the drawable as the anchor point, is it possible to set the anchor?

update:

This is the drawable(with 40x56 in pixel):



This is my code for adding marker:

protected void onCreate(Bundle savedInstanceState) { final MapView mapView = (MapView) findViewById(R.id.map_imp_esri); mapView.addLayer(new ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer")); Point p = new Point(-9664114.480484284,3962469.970217699); //Birmingham mapView.setResolution(mapView.getMinResolution()); GraphicsLayer graphicsLayer = new GraphicsLayer(mapView.getSpatialReference(), new Envelope(-180, -90, 180, 90)); mapView.addLayer(graphicsLayer); //add marker Drawable d = getResources().getDrawable(R.drawable.marker_a_normal); PictureMarkerSymbol sym = new PictureMarkerSymbol(d); sym.setOffsetX(-convertToDp(d.getIntrinsicWidth()) / 2); sym.setOffsetY(-convertToDp(d.getIntrinsicHeight()) / 2); Graphic g = new Graphic(p, sym); graphicsLayer.addGraphic(g);}private int convertToDp(double input) { final float scale = getResources().getDisplayMetrics().density; return (int) (input * scale + 0.5f);}But this is what I got:
:

The four screenshot are captured during zooming in the map.

Note, at the image 1, the marker event does not at the united states.

Do I miss anything?



أكثر...
 
أعلى