我有一個應用程序,它使用自定義實現MyLocationOverlay。MyLocationOverlay - 自定義圖像,但沒有陰影
在實現中,我通過Draw的重載設置了一個Bitmap屬性,該屬性在指定時使用。
它工作得很好,用我的自定義圖像,但它並沒有顯示陰影 - 如在ItemizedOverlay自動完成。
任何人都可以幫忙嗎?
這裏是(從相關的代碼)我的課:
public class LocationOverlay: MyLocationOverlay
{
/// <summary>Bitmap to use for indicating the current fixed location.</summary>
public Bitmap LocationMarker { get; set; }
/// <summary>Uses the custom marker bitmap if one has been specified. Otherwise, the default is used.</summary>
/// <param name="canvas"></param>
/// <param name="mapView"></param>
/// <param name="shadow"></param>
/// <param name="when"></param>
/// <returns></returns>
public override bool Draw(Canvas canvas, MapView mapView, bool shadow, long when)
{
var drawShadow = shadow;
if (LocationMarker != null && LastFix != null)
{
var screenPoint = new Point();
var geoPoint = new GeoPoint((int)(LastFix.Latitude * 1E6), (int)(LastFix.Longitude * 1E6));
mapView.Projection.ToPixels(geoPoint, screenPoint);
canvas.DrawBitmap(LocationMarker, screenPoint.X, screenPoint.Y - 32, null);
drawShadow = true;
}
base.Draw(canvas, mapView, drawShadow);
return true;
}
}
我對他的[這裏](http://spiritmachineblog.tumblr.com/post/31148616147/customising-mylocationoverlay-in-mono-for-android)進行了博客,您可以在其中看到_MyLocationOverlay_的完全自定義實現。 – manadart