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.
精彩评论