【发布时间】:2010-02-05 16:08:57
【问题描述】:
我能够在 Googlemap 上显示多个叠加项,现在我想更改任何特定叠加项的图标(以显示它是当前选定的事件)。我想通过导航按钮(下一个、上一个)来完成,就像在谷歌地图上一样。
我正在使用 StateListDrawable 来显示 OverlayItems 的图标。
图标文件是
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/selected_icon"/>
<item android:drawable="@drawable/unselected_icon"/>
</selector>
OverlayItem的getMarker方法代码如下。
@Override
public android.graphics.drawable.Drawable getMarker(int stateBitset){
Drawable icon;
icon = this.mapActivity.getResources().getDrawable(R.drawable.film_icon);
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
return icon;
}
现在我的问题是,当用户单击其中一个导航键时,如何更改地图上任何覆盖项/图标的状态?
非常感谢任何帮助。
【问题讨论】:
标签: android google-maps map overlay