在 OverlayItem 中旋转可绘制对象
我有一个地图视图,每个 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。
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 the rotated drawable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这个(更改签名以实际返回可绘制对象!)
旋转位图以匹配方位
Take a look at this (change the signature to actually return the drawable!)
Rotate Bitmap to Match Bearing