在OverlayItem中旋转drawable

时间:2011-07-19 17:10:21

标签: android android-mapview drawable

我有一个mapview,每个OverlayItem都有一个自定义项目,类就在这里。

 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); 
}   

}

我希望能够通过类中的标题旋转Drawable,这样当mapView调用它时,它将返回旋转的drawable。

1 个答案:

答案 0 :(得分:1)

看看这个(更改签名以实际返回drawable!)

Rotate Bitmap to Match Bearing