开发者

Rotate drawable in OverlayItem

开发者 https://www.devze.com 2023-03-21 04:38 出处:网络
I have a mapview that has a custom item per OverlayItem and the class is here. class MapObject extends OverlayItem{

I have a mapview that has a custom item per OverlayItem and the class is here.

 class MapObject extends OverlayItem{

 String name;
 String heading;

 Drawable marker = null;

PlaneObject(GeoPoint pt, String name, String snippet, Drawable marker){
    super(pt,name,snippet);
    this.marker = marker;
}

@Override
public Drawable getMarker(int stateBitset){
    Drawable result = marker;
    setState(result,stateBitset);
    result.setBounds(-result.getIntrinsicWidth()/2, -result.getIntrinsicHeight(), result.getIntrinsicWidth() /2, 0);
    //Want to rotate the drawable to the angle stored in the heading variable
    return(result); 
}   

}

I would like to be able to rotate the Drawable by the heading within the class so when the mapView calls it then it will return t开发者_运维技巧he rotated drawable.


Take a look at this (change the signature to actually return the drawable!)

Rotate Bitmap to Match Bearing

0

精彩评论

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