Maps V2 how to rotate Marker - where is rotation option?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 09:38:21

问题


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


回答1:


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).



来源:https://stackoverflow.com/questions/19082629/maps-v2-how-to-rotate-marker-where-is-rotation-option

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!