[英]Extending google maps Marker class
I need to extend this class to add some custom data to each marker as a property. 我需要扩展此类,以将一些自定义数据作为属性添加到每个标记。
Can the class be extended? 课程可以延长吗? If so how can I add a new property? 如果是这样,我该如何添加新属性?
Can the class be extended? 课程可以延长吗?
No, as it is marked as final
. 不,因为它被标记为final
。 You cannot create subclasses of the Maps V2 Marker
class. 您无法创建Maps V2 Marker
类的子类。
One workaround is to overload some data member of Marker
, such as the snippet, to use as the key to a collection of model objects (eg, HashMap
) that can contain whatever properties you want. 一种解决方法是重载Marker
某些数据成员(例如片段),以用作可以包含所需属性的模型对象集合(例如, HashMap
)的键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.