Google Maps Android API v2 - MarkerOptions draggable and visible methods

霸气de小男生 提交于 2019-12-09 12:55:21

问题


I'm playing with the new Google Maps Android API (v2) released earlier this month and I was delighted to see a MarkerOptions.draggable(boolean draggable) method which I thought would create a draggable marker when passing in a draggable value of true. However, on trying it (i.e. adding a marker as such to the map), it doesn't seem to do anything.

The MarkerOptions.visible(boolean visible) method too, which I thought would hide the marker from view when passing in a visible value of false.

Anyone been able to get these methods to work?


回答1:


The latter issue is already in the Google Bug Tracker.

The draggable method should work. Look at the provided Sample project. Maybe the drag starts after a longpress, like in the Sample project?

    // Creates a draggable marker. Long press to drag.
    mMelbourne = mMap.addMarker(new MarkerOptions()
            .position(MELBOURNE)
            .title("Melbourne")
            .snippet("Population: 4,137,400")
            .draggable(true));


来源:https://stackoverflow.com/questions/13819832/google-maps-android-api-v2-markeroptions-draggable-and-visible-methods

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