我正在使用谷歌地图API来显示地图。它用英语显示谷歌地图,但我想以印地文语言显示谷歌地图内容。我正在使用此代码,但它不起作用:
String languageToLoad = "hi"; // your language
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getActivity().getBaseContext().getResources().updateConfiguration(config,
getActivity().getBaseContext().getResources().getDisplayMetrics());
答案 0 :(得分:-1)
更改语言代码:
String languageToLoad = "hi_IN";
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();