无法通过Android 8.0.0编程更改Google Pixel中的语言环境
我需要将我的应用程序语言从英文改为中文。我可以在很多设备上做到这一点,除了谷歌Pixel,它有安卓8.0.0。 我正在为此使用以下代码无法通过Android 8.0.0编程更改Google Pixel中的语言环境,android,Android,我需要将我的应用程序语言从英文改为中文。我可以在很多设备上做到这一点,除了谷歌Pixel,它有安卓8.0.0。 我正在为此使用以下代码 public static void changeLocaleTo(String locale){ Resources res = App.getContext().getResources(); DisplayMetrics dm = res.getDisplayMetrics(); a
public static void changeLocaleTo(String locale){
Resources res = App.getContext().getResources();
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.setLocale(new Locale(locale.toLowerCase())); // API 17+ only.
conf.locale = (new Locale(locale.toLowerCase()));
res.updateConfiguration(conf, dm);
//for Build>=25
//res.createConfiguration(conf, dm);
}
我用下面的链接尝试了很多东西
但是没有人能改变我的像素手机的语言
请注意:但是,如果我从设备设置更改我的设备语言,我的应用程序也会更改为中文版本(像素)
我在res的'values zh'文件夹中有中文字符串 你找到解决办法了吗?有人找到答案了吗?我也有同样的问题。如果你知道,请分享。你找到解决方案了吗?