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.
The sreenshot is attached.
)
I've noticed that this bug occurs only on LinearLayout (which is very weird).
Try RelativeLayout instead, or, if you have API 17 and above, set textDirection for each of the TextViews, and it should work
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.
Fortunately, you can supply your own info window contents, by implementing
InfoWindowAdapter
and havinggetInfoContents()
return theView
that you want to use in the info window.For example, this sample project (from tomorrow's update to my book) shows customizing the info window using this
InfoWindowAdapter
:If you want to replace the whole window, you would have
getInfoWindow()
return aView
. IfgetInfoWindow()
returnsnull
,getInfoContents()
is used for the contents of the window. You then attach an instance ofInfoWindowAdapter
viasetInfoWindowAdapter()
on yourGoogleMap
.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.
Adding more info regarding CommnsWare answer:
As of the moment I am writing this commend, it seems that the map itself is
layout_direction="LTR"
which means that your titles will not be flipped on RTL desktops. The solution is simple:Note that I am using the locale's layout direction and not the inherited direction. I commented this on the corresponding Google bug report here: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5608#makechanges