简体   繁体   English

更改后如何将Google Map Marker设置回默认图标?

[英]How can I set a Google Map Marker back to the default icon after changing it?

I am using the android-maps-utils library with a Google Map in an android app I'm working on, and I have several markers on the map. 我正在使用的android-maps-utils应用程序中将android-maps-utils库与Google Map一起使用,并且在地图上有多个标记。 I change the icons for some markers when certain conditions are met using setIcon() with an IconGenerator . 我当某些条件下使用遇见改变一些标记图标setIcon()IconGenerator

I want to then change the icons back to the original red Google Maps standard icons when a different condition is met. 当满足其他条件时,我想将图标改原来的红色Google Maps标准图标。 I can track the condition and change them to a different custom icon, but don't know how to return them to the Google default short of finding an icon somewhere online and adding it into my project to add manually as I am with my personalized ones. 我可以跟踪条件并将其更改为其他自定义图标,但是不知道如何将它们返回到Google默认值,只是在网上某个地方找到一个图标并将其添加到我的项目中,以便像我使用个性化图标一样手动添加。 Does anyone know how to retrieve the defaults? 有谁知道如何检索默认值?

你可以做

marker.setIcon(BitmapDescriptorFactory.defaultMarker());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM