AlertDialog 打开后 Android 地图叠加层移动
我有一个基于地图的 Android 程序,运行良好,当单击叠加层时,它会打开一个警报对话框...
我启动应用程序,看到我的叠加层,一切都很好,直到我选择叠加层。当我选择覆盖时,我的警报对话框按预期出现,但当我关闭它时,突然所有注释突然向下和向右移动一点,然后从该点开始保持移动。
看起来覆盖层的边界突然因为设置在我用于覆盖层的图像中间(图像的右上角)而重新发送。这是已知的 Android 问题吗?在我最初将其设置为配置到中心之后,我的代码中没有任何内容明确地处理图像的边界,但这似乎正在发生......有什么想法吗?
I have a map based Android program, that is working nicely, I have it opening an alert dialog when an overlay is clicked...
I start the app, and see my overlays, and all is fine, until I select an overlay. When I select an overlay, my alert dialog appears as expected, but when I close it, suddenly all the annotations suddenly shift down and right a little bit, and then stay shifted from that point on.
It almost seems like the bounds of the overlay suddenly got resent from being set on the middle of the image I am using for the overlay, the top right corner of the image. Is this a KNOWN android issue? I don't have anything in my code explicitely playing with the bounds of the image after I initially set it to the be configured to the center yet this seems to be happening... any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想通了,我正在将我的覆盖层的可绘制对象传递给AlertDialog以用作其图标...显然,AlertDialog代码将我的可绘制对象的边界从我设置的中心底部重置为左上角,因此当我关闭对话框并且地图重新绘制时,所有叠加层都会发生移动,以便该位置位于叠加图像的右上角,而不是从该点开始的中心。
如果 API 文档提到这一点就好了。
I figured it out, I was passing the drawable that was my overlay to the AlertDialog to be used as its ICON... apparently the AlertDialog code reset the bounds on my Drawable from being Center Bottom as I had it set up, to top left, and so when I dismissed the dialog and the map redrew all the overlays shifted so that there location was upper right of the Overlay Image and not the center of it from that point forward.
It would have been nice if the API documentation mentioned this.