protected override void SetBounds(Drawable marker, int markerId, NMapOverlayItem item) { // check shape of the marker to set bounds correctly. if (NMapPOIflagType.IsBoundsCentered(markerId)) { if (marker.Bounds.IsEmpty) { NMapOverlayItem.BoundCenter(marker); } if (null != item) { item.SetAnchorRatio(0.5f, 0.5f); } } else { if (marker.Bounds.IsEmpty) { NMapOverlayItem.BoundCenterBottom(marker); } if (null != item) { item.SetAnchorRatio(0.5f, 1.0f); } } }
public Drawable GetDrawableWithNumber(int resourceId, string strNumber, float offsetY, int fontColor, float fontSize) { Bitmap textBitmap = GetBitmapWithText(resourceId, strNumber, fontColor, fontSize, offsetY); //Log.i(LOG_TAG, "getDrawableWithNumber: width=" + textBitmap.getWidth() + ", height=" + textBitmap.getHeight() + ", density=" + textBitmap.getDensity()); // set bounds Drawable marker = new BitmapDrawable(MContext.Resources, textBitmap); if (marker != null) { NMapOverlayItem.BoundCenter(marker); } //Log.i(LOG_TAG, "getDrawableWithNumber: width=" + marker.getIntrinsicWidth() + ", height=" + marker.getIntrinsicHeight()); return(marker); }