【问题标题】:How can I set my compass direction in always to the west?我怎样才能将我的指南针方向始终向西?
【发布时间】:2012-05-07 06:25:43
【问题描述】:

我制作了一个谷歌地图,其中指南针自动指向北方。 但我必须让这个指南针的指针始终指向西方。 我该怎么做?有什么想法吗?我需要执行任何特殊条款吗? 请帮帮我:(

【问题讨论】:

  • @Override public void onResume() { super.onResume(); MyLocationOverlay me.enableCompass();} 我只是启用了指南针,它会自动生成。

标签: android google-maps compass-geolocation direction


【解决方案1】:

[方位从北 + 90°] 模(360)

从 MyLocationOverlay 派生您自己的类。 覆盖 drawCompass(); 根据需要操作您收到的 Canvas 对象。 调用 super.drawCompass() 在新位置绘制指南针。 将画布恢复到您找到它的样子。

protected void drawCompass(android.graphics.Canvas canvas,float bearing) 是您想要的关键!取北方位后方位值变化不大

【讨论】:

  • 如何在我的地图活动中设置它?
  • 从 MyLocationOverlay 派生您自己的类。覆盖 drawCompass();根据需要操作您收到的 Canvas 对象。调用 super.drawCompass() 在新位置绘制指南针。将画布恢复到您找到它的样子。
  • 你有什么有用的链接可以更完美地帮助我吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-04-15
  • 1970-01-01
  • 1970-01-01
  • 2015-08-03
  • 1970-01-01
  • 2011-09-06
  • 1970-01-01
相关资源
最近更新 更多