地图标记管理,Android版标记、地图、Android

2023-09-06 23:23:04 作者:一起长大的约定

我有一个地图,dispays标记。如果用户点击一个标记弹出显示出来。一种方法计算wheather有在点击位置的标记。

I have a map that dispays markers. If the user clicks on a marker a popup shows up. A method calculates wheather there is a marker at the clicked position.

我的问题是,我有很多不同的标记,但在这个方法我只能处理一个特定的标记。

My Problem is that I have a lot of different markers, but in this method I can handle only one specific marker.

我需要的东西一般般位图,保存所有标记的​​资源。例如。我不魔杖手动处理100个标记,因为所有的都是一个位图,所以我只需要处理一个普通的位图。

I need something like a general bitmap, that holds all marker resources. E.g. I do not wand to handle 100 markers manually, because all are a Bitmap so I need just to handle one general bitmap.

什么想法?

推荐答案

我已经解决了我的问题。我定义保存包含intergers静态字段MarkerManager类。

I have solved my problem. I define a MarkerManager class that holds static fields that contain intergers.

public class MarkerManager{
    private static final int ME = 1;

public static int getResource(int id){
    int marker = 0;
    switch(id){
    case id:
        marker = R.drawable.me;
    break;

    }
    return marker;
}

}