地图V2如何旋转标记 - 旋转选项在哪里? [英] Maps V2 how to rotate Marker - where is rotation option?

查看:82
本文介绍了地图V2如何旋转标记 - 旋转选项在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我所有的文档,例如...
此链接



旋转是一个有效的标记选项。但它并不存在!



例如,如果您将此文档中引用的代码放入您的程序中......

  static final LatLng PERTH = new LatLng(-31.90,115.86); 
Marker perth = mMap.addMarker(new MarkerOptions()
.position(PERTH)
.anchor(0.5,0.5)
.rotation(90.0));

轮转被标记为不是有效的MarkerOption。



我也尝试在返回的Marker对象上执行setRotation(float),将其标记为无效。

那么,文档是否不好?难道我做错了什么?我怎样才能旋转标记?
谢谢,
加里

解决方案



不,文档完全正常,至少就此而言。


我做错了什么?


您没有附加最新的Play Services SDK你的项目,很可能。您需要从SDK Manager下载R12,然后将该库项目附加到您的项目中(替换您现有的任何版本)。

/github.com/commonsguy/cw-omnibus/tree/master/MapsV2/FlatMarkersrel =nofollow>这是一个示例项目,演示如何使用 rotation()(以及平面标记)。


According to all the docs I have, such as... this link

"rotation" is a valid marker option. But it's not there!

For instance if you put this code cited in the docs into your program ...

static final LatLng PERTH = new LatLng(-31.90, 115.86);
Marker perth = mMap.addMarker(new MarkerOptions()
                          .position(PERTH)
                          .anchor(0.5,0.5)
                          .rotation(90.0));

the rotation is flagged as not being a valid MarkerOption.

I also tried doing setRotation(float) on a returned Marker object to that got flagged as invalid too.

So, are the docs bad? Am I doing something wrong? How can I rotate the Marker?? Thanks, Gary

解决方案

So, are the docs bad?

No, the docs are perfectly fine, at least with respect to this.

Am I doing something wrong?

You do not have the latest Play Services SDK attached to your project, most likely. You need to download R12 from the SDK Manager, then attach that library project to your project (replacing whatever version you have today).

Here is a sample project demonstrating the use of rotation() (and flat markers as well).

这篇关于地图V2如何旋转标记 - 旋转选项在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆