添加一个按钮,自定义InfoWindowAdapter认为可以注册的点击 [英] Adding a button to a custom InfoWindowAdapter view that can register clicks

查看:425
本文介绍了添加一个按钮,自定义InfoWindowAdapter认为可以注册的点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了自定义布局,Android的谷歌地图API v2的地图片段的InfoWindowAdapter。我已经把我从getInfoWindow()返回视图的按钮,而它显示完全正常,当我点击按钮,说:窗口本身注册一个点击(用黄色调像往常一样闪烁),而按键则没有。

I'm adding an InfoWindowAdapter with a custom layout to the Android Google Maps API v2 based map fragment. I've put a button in the view I return from getInfoWindow() and while it shows up perfectly fine, when I click on said button the window itself registers a click (blinking with a yellowish tint as usual) while the button does not.

我怎样才能使信息窗口点击按钮?而且,推而广之,一个信息窗口内的任何观点?

How can I make a button in the info window "clickable"? And, by extension, any view inside an info window?

推荐答案

相反,监听标记点击事件与OnMarkerClickListener并直接显示您自己的完整视图。这可能是更多的工作把它然而锚定到标记的位置。尝试 PopupWindow 与showAtLocation(查看父,诠释重力,诠释的x,int y)对

Instead, listen for marker click events with OnMarkerClickListener and display your own complete view directly. It may be a bit more work to anchor it to the location of the marker, however. Try PopupWindow with showAtLocation(View parent, int gravity, int x, int y)

这篇关于添加一个按钮,自定义InfoWindowAdapter认为可以注册的点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆