android'MapView'天气就像叠加一样

时间:2011-11-08 12:08:10

标签: android android-mapview

https://lh3.googleusercontent.com/-A6VHppSxRyk/TrkVmkzTPDI/AAAAAAAACaQ/sEDVPWNcmIs/s293/Untitled.png

我正试图在我的地图中显示天气状况,如上所示,我该如何实现?

1 个答案:

答案 0 :(得分:1)

创建一个扩展Overlay的类并将其添加为叠加层。 在课堂上你重写

@Override
public void draw(Canvas c, MapView mapView, boolean shadow) {
  //super.draw(c, mapView, shadow);

  if (shadow) return; // no shadows

  Rect canvasRekt = new Rect(0, 0, c.getWidth(), c.getHeight());
  Rect kortRekt = ...

  c.drawBitmap(overlejretKort, canvasRekt, kortRekt, paint);
  c.drawRect(kortRekt, paint);
}

kortRekt应该包含位图的矩形(这里称为overlejretKort)