frAydjwe Posté(e) 9 mai 2011 Share Posté(e) 9 mai 2011 Bonjour, Je dispose de cette classe (récupéré sur la doc android) : package com.android.webtrack; import java.util.ArrayList; import android.app.AlertDialog; import android.content.Context; import android.graphics.drawable.Drawable; import com.google.android.maps.ItemizedOverlay; import com.google.android.maps.OverlayItem; public class HelloItemizedOverlay extends ItemizedOverlay<OverlayItem> { private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>(); Context mContext; public HelloItemizedOverlay(Drawable defaultMarker) { // Now define the HelloItemizedOverlay constructors. //The constructor must define the default marker for each of the OverlayItems. //In order for the Drawable to actually get drawn, it must have its bounds defined. //Most commonly, you want the center-point at the bottom of the image to be the point at which it's attached to the map coordinates. //This is handled for you with the boundCenterBottom() method. Wrap this around our defaultMarker, so the super constructor call looks like this: super(boundCenterBottom(defaultMarker)); // TODO Auto-generated constructor stub } // new class constructor public HelloItemizedOverlay(Drawable defaultMarker, Context context) { super(boundCenterBottom(defaultMarker)); mContext = context; } @Override protected OverlayItem createItem(int i) { return mOverlays.get(i); } @Override public int size() { return mOverlays.size(); } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } @Override protected boolean onTap(int index) { OverlayItem item = mOverlays.get(index); AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); dialog.setTitle(item.getTitle()); dialog.setMessage(item.getSnippet()); dialog.show(); return true; } } J'aimerais ajouter une zone de texte dessus le marqueur android, et pas avec OnTap comme dans cette classe. Comment faire ?? Je vous remercie ! Lien vers le commentaire Partager sur d’autres sites More sharing options...
Recommended Posts
Archivé
Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.