是否可以从 Android 中的地图覆盖项打开上下文菜单?
下面的代码可以很好地打开警报对话框。我想知道是否可以从地图叠加类中打开上下文菜单?
@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;
}
This below code works fine opening an alert dialog. I was wondering if it's possible to open a context menu from within a map overlay class?
@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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,你不能在mapView上打开上下文菜单
我想让onTap事件打开上下文菜单我尝试了大多数方法,但都是徒劳。
如果您愿意,也许您应该使用 Alert.Builder 及其三个按钮来执行操作。或者更好的是有一个定制的警报视图。
那不起作用
No you can't open a context menu on mapView
I wanted to have onTap event open context menu I tried most of methods but all in vain.
Maybe you should use Alert.Builder with it's three button to perform actions if you want. or better have a customized alert view.
that don't works
这可能有效。
This may work.