English 中文(简体)
页: 1
原标题:Different named Markers on Google Android Map

i 希望在地图上添加许多不同的标识。 我的法典迄今为止运作良好,同样超支:

mapOverlays = mapView.getOverlays();
drawable = this.getResources().getDrawable(R.drawable.marker);
itemizedOverlay = new MyItemizedOverlay(drawable);
OverlayItem overlayItem = new OverlayItem(geoPoint, "foo", "bar");
mapOverlays.add(itemizedOverlay);

This works fine so far. But every marker is the same. What I want to do now is having different markers on the map like the ones you see on Google Maps Webapp (a marker named "A", the next one "B", and so on). How can I achieve this? Do I have to add an extra png marker file to my app ? (marker_a.png, marker_b.png,...) or is there a simpler way to achieve this? It could also be that there will be more than 26 results so that i possibly need different colours of the markers.

问题回答

其中一个答复为每个标识组提供了不同的<代码>系统化Overlay的解决办法。 可通过单一<条码>射线<<>代码>实现。 <代码>overlayItem.setMarker (drawable)

如果你将用资源装上你的标识,那么不要忘记:

drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());

页: 1 否则将不显示标记。

由于标识为<代码>可转让,你可以像任何其他<代码>>可转让<>代码/代码”一样获得标识,包括创建其操作时间。

这里是一个样本项目,在单一<代码>上显示几个不同的PNGs。 你们必须放弃一些处理不同政体的提款方法。

是的,你需要另一平方,因此,希望:

mapOverlays = mapView.getOverlays();

// All "A"s
drawable = this.getResources().getDrawable(R.drawable.marker_a);
itemizedOverlay = new MyItemizedOverlay(drawable);
OverlayItem overlayItem = new OverlayItem(geoPoint, "foo", "bar");
mapOverlays.add(itemizedOverlay);

// All "B"s
drawable = this.getResources().getDrawable(R.drawable.marker_b);
itemizedOverlay = new MyItemizedOverlay(drawable);
OverlayItem overlayItem = new OverlayItem(geoPoint, "foo", "bar");
mapOverlays.add(itemizedOverlay);

我也陷入了同样的境地,我希望看到A、B、C的ins。

好消息是,我找到了解决办法。 我只编写了带平级背景的案文,并在文字中加插一些内容,将其转换成可图的文字。

你可以产生你希望的有色背景的不同文字。

http://stackoverflow.com/questions/6501413/how-to-create-dynamically- numbered-pin-pointers-on-mapview” 我回答的问题:

我使用了该守则:

 OverlayItem crtItem = new OverlayItem( getPoint( Double.parseDouble(latCoordRow),Double.parseDouble(longCoordRow) ), nameRow , addressRow );

  Drawable crtMarker = markerIconsArray.get(categoryRow); //my current drawable (from a HashMap)
  crtItem.setMarker(crtMarker); // set new marker
  crtMarker.setBounds(0, 0, crtMarker.getIntrinsicWidth(),crtMarker.getIntrinsicHeight()); //setBounds
  boundCenterBottom(crtMarker); //correct shadow problem

如果你不把你 draw得的 won子 show。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签