如何解决Google Maps Android v2上的语言环境问题?

时间:2018-10-16 06:44:27

标签: android google-maps google-play-services

我使用的是Google Maps v2 Android sdk,将应用程序的语言环境更改为亚美尼亚语时,Maps不显示街道名称(仅显示一些英文名称)。

用于更改语言环境的代码:

    private static Context setLocale(Context context, String language) {
    Locale locale = new Locale(language);
    Locale.setDefault(locale);

    Resources resources = context.getResources();
    Configuration config = new Configuration(resources.getConfiguration());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        config.setLocale(locale);
        context = context.createConfigurationContext(config);
    } else {
        config.locale = locale;
        resources.updateConfiguration(config, resources.getDisplayMetrics());
    }
    return context;
}

我知道存在与另一种语言有关的问题: https://issuetracker.google.com/issues/36823099

English locale Armenian locale

1 个答案:

答案 0 :(得分:0)

目前,某些语言只能使用Android客户端库v3.1.0 Beta Maps SDK来提供。我会尝试一下。

遵循迁移指南https://goo.gle/v3-migration-guide

这是一个Beta版本,请在问题跟踪器[https://goo.gle/gmp-android-sdk-beta-issues]的新组件中提供您的反馈,以帮助尽快退出Beta。

>