更改Android GoogleMaps中的标记文本 [英] Changing a Marker's text in Android GoogleMaps

查看:113
本文介绍了更改Android GoogleMaps中的标记文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在GoogleMap标记已经设置好之后更改其内部的文本?我使用MarkerOptions来设置标题和代码片段,原来是这样的:
$ b $ pre $ support_MapFragment 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);

稍后,当用户点击某些内容时,我想执行反向地理编码查找并更改标题/片段包含地址信息。

解决方案


是否可以更改GoogleMap Marker是否已设置好?


标记 setTitle() setSnippet()方法。你需要一个代表这个标记的 Marker 对象,可能是你从 addMarker()调用中保留的一个对象。 / p>

Is it possible to change the text inside a GoogleMap Marker after it's already been set? I'm using MarkerOptions to set the title and snippet originally like this:

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

Later, when the user taps on something, I'd like to perform the reverse geocode lookup and change the title/snippet to contain address information.

解决方案

Is it possible to change the text inside a GoogleMap Marker after it's already been set?

Marker has setTitle() and setSnippet() methods. You will need a Marker object representing this marker, probably one that you held onto from the addMarker() call.

这篇关于更改Android GoogleMaps中的标记文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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