谷歌地图Android的API V2,标记标题/段错误的显示

问题描述:

我用谷歌地图Android的API V2与Android,以显示当前位置与附近的标记。 附近的地方位置和标题都使用谷歌API的地方接受。

I use Google Maps Android API v2 with Android to show current position with nearby markers. Nearby places locations and titles are received using Google Places API.

现在的问题是,在标题/段非英语名称显示在失败的方式。 对于例如,希伯来文的名字。

The problem is that non-english names at title/snippet are shown in fail way. For the instance, Hebrew names.

该sreenshot连接。

The sreenshot is attached.

)

由于阿拉伯语和希伯来语是造成问题,英语和俄语都没有,我会猜的东西是在默认的信息窗口的实现相对于破从右到左(RTL)语言。特别是如果你在Android 4.2上运行你的测试,这可能是因为地图V2的默认信息窗口的内容错误地应用了各种RTL相关的属性。

Since Arabic and Hebrew are causing problems, and English and Russian are not, I am going to guess that something is broken in the default info window implementation with respect to right-to-left (RTL) languages. Particularly if you are running your tests on Android 4.2, it may be that Maps V2's default info window contents have incorrectly applied the various RTL-related attributes.

幸运的是,你可以通过执行 InfoWindowAdapter 并具有 getInfoContents提供自己的信息窗口的内容,()返回查看要在信息窗口中使用。

Fortunately, you can supply your own info window contents, by implementing InfoWindowAdapter and having getInfoContents() return the View that you want to use in the info window.

例如,此示例项目(从明天的更新,我的书)显示使用定制信息窗口此 InfoWindowAdapter

For example, this sample project (from tomorrow's update to my book) shows customizing the info window using this InfoWindowAdapter:

class PopupAdapter implements InfoWindowAdapter {
  LayoutInflater inflater=null;

  PopupAdapter(LayoutInflater inflater) {
    this.inflater=inflater;
  }

  @Override
  public View getInfoWindow(Marker marker) {
    return(null);
  }

  @Override
  public View getInfoContents(Marker marker) {
    View popup=inflater.inflate(R.layout.popup, null);

    TextView tv=(TextView)popup.findViewById(R.id.title);

    tv.setText(marker.getTitle());
    tv=(TextView)popup.findViewById(R.id.snippet);
    tv.setText(marker.getSnippet());

    return(popup);
  }
}

如果您要更换整个窗口,你会 getInfoWindow()返回查看。如果 getInfoWindow()返回 getInfoContents()是用于窗口中的内容。然后,通过 setInfoWindowAdapter附上 InfoWindowAdapter 实例() GoogleMap的

If you want to replace the whole window, you would have getInfoWindow() return a View. If getInfoWindow() returns null, getInfoContents() is used for the contents of the window. You then attach an instance of InfoWindowAdapter via setInfoWindowAdapter() on your GoogleMap.

在你的情况,你可以使用自己的布局,以确保你正确地实现RTL。也就是说,原则,明确了这个问题。可以想象的是,地图V2做一些奇怪的事情,打破RTL code,通常应该工作,在这种情况下,你需要的文件中的问题

In your case, you could use your own layout to make sure that you are implementing RTL correctly. That should, in principle, clear up this problem. It is conceivable that Maps V2 does something strange that breaks RTL code that normally should work, in which case you'd need to file an issue.