如何更改语言Google Map V2 android [英] How to change language Google Map V2 android
问题描述
我正在使用 google-play-service-lib
。如何更改Google地图的语言,即以科里语或印地语显示地点。 您可以更改Google地图的位置通过使用
I am using google-play-service-lib
. How can I change language of google map i.e. show locations in korian language or Hindi Language.
You can change location for Google Maps that use the Google Map API V2 by using a Locale Object. The language needs to be supported on the device being used though.
Here is the full list of supported languages.
With this code below I was able to change the language on the map to Chinese:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String languageToLoad = "zh_CN";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
setContentView(R.layout.activity_maps);
setUpMapIfNeeded();
}
Result, language set to Chinese in the code (no manual changes) on a U.S. based phone:
I was also able to get it to show Korean, use this Locale code:
String languageToLoad = "ko_KR";
Result:
NOTE
It looks like the supported languages for Google Maps are listed here: https://developers.google.com/maps/faq#languagesupport
这篇关于如何更改语言Google Map V2 android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!