我使用android-mapviewballoons库来显示气球。 因此,一旦用户点击我的标记,就会显示气球。如何在地图显示时在地图上显示气球?
我有问题:如何显示特定项目的气球而无需等待用户点击?
Upd。如何识别我? 目前,我有以下几点:
public class Map extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
// here I have extras.getDouble("lat") and extras.getDouble("lng") -
// the location balloon should be shown for
...
itemizedOverlay = new MapOverlay(drawable, mapView);
for (int i = 0; i < items.getCount(); i++) {
// here I add markers, one of them will have lat and lng equal to
// the values passed in extras
public class MapOverlay extends BalloonItemizedOverlay<OverlayItem> {
...
protected OverlayItem createItem(int i) {
此外,关于下面的代码:
// BalloonOverlayView is a raw type. References to generic type BalloonOverlayView<Item> should be parameterized
BalloonOverlayView bov = new BalloonOverlayView(context, 50);
// What is item there? should be getItem(i)?
bov.setData(item);
// The method setPosition(int) is undefined for the type BalloonOverlayView
BalloonOverlayView.setPosition(i);
你最好问一下该库的开发人员,他们可能会也可能不会看到这个StackOverflow问题。 – CommonsWare
谢谢,@CommonsWare。其实,我已经给他发了一条消息,但是希望这里的某个人也已经实施了。 –