在设置好谷歌地图标记后,是否可以更改其中的文本?我使用markeroptions设置标题和代码片段,最初是这样的:
SupportMapFragment theMapFragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);
GoogleMap theMap = theMapFragment.getMap();
MarkerOptions theMarker = new MarkerOptions();
theMarker.position(theLatLng);
theMarker.title("My title");
theMarker.snippet("This is my snippet");
theMarker.visible(true);
theMap.addMarker(theMarker);
稍后,当用户点击某些内容时,我想执行反向地理代码查找,并将标题/代码片段更改为包含地址信息。
最佳答案
在设置好谷歌地图标记后,是否可以更改其中的文本?Marker
有setTitle()
和setSnippet()
方法。您将需要一个表示这个标记的Marker
对象,可能是您从addMarker()
调用中保留的对象。
关于android - 在Android Google Maps中更改标记文字,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19009863/