了解代码以更改Android中的叠加层标记

时间:2012-03-30 16:03:53

标签: java android android-maps

我尝试了answer by Sherif elKhatibHow to change the marker for the overlay on tap for android?,但有些事情我不明白。

protected boolean onTap(int index)
{
    // Here, what is mOverlays? I mean it is the object of what?
    OverlayItem item = mOverlays.get(index);
    // Is the mContext, the object of Context?
    Drawable marker = mContext.getResources().getDrawable(R.drawable.icon);
    marker.setBounds(0,0,marker.getIntrinsicWidth(),marker.getIntrinsicHeight());
    item.setMarker(marker);
    return true;
}

什么是mOverlaysmContext

1 个答案:

答案 0 :(得分:1)

  

什么是mOverlays和mContext?

mOverlays大概是List<OverlayItem>,因为它以get()回复OverlayItem

mContextContext,可能是您的MapActivity