更改Android GoogleMaps中的标记文本 [英] Changing a Marker's text in 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屋!