点击标记时,空的信息窗口 [英] Empty InfoWindow when Marker is clicked

查看:104
本文介绍了点击标记时,空的信息窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的code到新的标记添加到我的GoogleMap:

This is my code to add new Markers to my GoogleMap:

MarkerOptions m = new MarkerOptions();
m.title(title);
m.snippet(snippet);
m.position(location);
mMap.addMarker(m);

mMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
        @Override
        public void onInfoWindowClick(Marker marker) {
            Toast.makeText(DemoActivity.this, "WindowClicked: "+ marker.getTitle() + ":" + marker.getSnippet(),
                    Toast.LENGTH_SHORT).show();
        }
    });

现在这一切正常,当我的标题都是英文的。该信息窗口吐司工作正常。

Now This works just fine when my title and snippet are in English. The infoWindow and the Toast works as expected.

然而,在我的情况下,标题在阿拉伯语中,吐司工作正常,但 信息窗口显示空窗口

However, as in my case, title and snippet are in Arabic, the Toast works fine but the InfoWindow shows empty window.

在我看来,像与阿拉伯语的错误。有没有办法来解决呢?

It seems to me like a bug related to Arabic language. Is there a way to work around it?

推荐答案

解决的办法是将显示自定义的信息窗口。您可以通过创建做到这一点<一个href="http://developer.android.com/reference/com/google/android/gms/maps/GoogleMap.InfoWindowAdapter.html">InfoWindowAdapter和<一个设置它href="https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap#setInfoWindowAdapter">GoogleMap.setInfoWindowAdapter().

A way around this would be to show a custom info window. You can do this by creating a InfoWindowAdapter and setting it with GoogleMap.setInfoWindowAdapter().

要替换默认的信息窗口,覆盖getInfoWindow(标记)与您的自定义呈现,并返回null getInfoContents(标记)。只更换默认的信息窗口框架(标注泡沫)里面的信息窗口的内容,返回null在getInfoWindow(标记),并覆盖getInfoContents(标记)来代替。

To replace the default info window, override getInfoWindow(Marker) with your custom rendering and return null for getInfoContents(Marker). To replace only the info window contents inside the default info window frame (the callout bubble), return null in getInfoWindow(Marker) and override getInfoContents(Marker) instead.

详细信息:<一href="https://developers.google.com/maps/documentation/android/marker#info_windows">https://developers.google.com/maps/documentation/android/marker#info_windows

这篇关于点击标记时,空的信息窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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