android - Osmdroid: How to create a Contextmenu next to a Marker? -
my goal: want show popupmenu next osmdroid-marker
my problem:
- in android can attach android.widget.popupmenu android.view.view : menu shown next view.
- in osmdroid marker inherited org.osmdroid.views.overlay.overlay. unfortunately overlay not inherited view cannot attach popup it.
currently attaching menu image in lower right corner may far away current marker.
this current code (from https://github.com/k3b/androfotofinder/blob/fdroid/app/src/main/java/de/k3b/android/androfotofinder/locationmap/locationmapfragment.java )
public class locationmapfragment extends dialogfragment { ... protected boolean showcontextmenu(final view parent, final int markerid, final igeopoint geoposition, final object markerdata) { menuinflater inflater = getactivity().getmenuinflater(); // contextmenu attached image "this.mimage" // not correspont "geoposition" // how create temporary 1x1 view @ "geoposition" // can attach menu to? popupmenu menu = new popupmenu(getactivity(), this.mimage); inflater.inflate(r.menu.menu_map_context, menu.getmenu()); menu.setonmenuitemclicklistener(new popupmenu.onmenuitemclicklistener() { @override public boolean onmenuitemclick(menuitem item) { switch (item.getitemid()) { case r.id.cmd_gallery: return showgallery(getigeopointbyid(markerid, geoposition)); case r.id.cmd_zoom: return zoomtofit(getigeopointbyid(markerid, geoposition)); default: return false; } } }); menu.show(); return true; } }
my question: there simple way create temporary 1x1 pixel window on top of marker @ igeopoint geoposition
can attach popup to?
or there other simple way position menu?
use osmbonuspack marker infowindow (marker bubble).
you can view infowindow.getview(), , regular android.view.view.
you can design layout make small needed.
Comments
Post a Comment