开发者

Android mapView: rotate overlay item

I want to rotate an overlay item (a drawable) according to my bearing onLocationChanged. How do I do this? I tried with the drawable, with the itemizedOverlay, and with the overlayItem, but no success.

public void bearingRotation(float boatBearing){                     
    Bitmap bm = ((BitmapDrawable)drawableCurrPos).getBitmap();          
    Matrix mat = new Matrix();
    mat.postRotate(boatBearing);
    Bitmap开发者_StackOverflow bMapRotate = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),bm.getHeight(), mat, true);

    drawableCurrPos = new BitmapDrawable(bMapRotate);                       
}


I would suggest that you convert that drawable to bitmap.

 Bitmap bm = ((BitmapDrawable)drawable).getBitmap();
Matrix mat = new Matrix();
        mat.postRotate(90);
        Bitmap bMapRotate = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),bm.getHeight(), mat, true);

Convert this bMapRotate using BitmapDrawable and apply that as a pin pointer to your location.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜