我可以个性化 googlemapview 上项目的 onTap() 对话框吗? (我想在上面添加一个按钮)
我有一个带有 itemizedoverlays 的地图视图,与 Android 开发人员指南的示例完全相同: http://developer.android.com/resources/tutorials/views/hello-mapview.html
在该示例中,当您按下某个项目时,它会显示一个带有标题和正文的对话框
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;
}
:工作正常,我仍然需要显示该对话框,但我需要添加一个按钮,当我按下它时,它会加载一个新活动,也许还有更多文本行。
我该怎么做呢?
I have a mapview, with itemizedoverlays, exactly like in the example of Android Developer's guide: http://developer.android.com/resources/tutorials/views/hello-mapview.html
At that example, when you press on a item, it's showed a dialog with a title and a body:
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;
}
It works fine, and I still need to show that dialog, but I need to add A BUTTON, that when I press it it loads a new activity, and maybe some more text lines.
How can I do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,这是可能的。
我就是这样做的。请注意,还可以使用 setNeutralButton。
据我所知,您可以使用这 3 个按钮。
也看看这个。 Android 开发者上的 AlertDialog
Sure, that's possible.
This is how I do it. Do note that there's also a setNeutralButton possible.
That's 3 buttons you can use as far as I know.
Look at this as well. AlertDialog on Android Developers