我正在尝试更改语言Android手机全系统在我的应用程序上,因为我们的目标是定制一个设置应用程序。
我已经尝试过这个,但没有成功:
Configuration conf = Resources.getSystem().getConfiguration();
conf.locale = toSet; //toSet is a Locale which I want to set to the system
conf.setToDefaults();
另一种尝试也不起作用:
Locale.setDefault(toSet)
有很多方法可以改变应用程序的语言,但不能改变系统。
有什么方法可以让我达到目标吗?
获得 root 权限对我有用吗?
或者有什么方法可以修改Intent-Activity的UI界面吗?
我发现,在源代码中,"platform/packages/apps/Settings/src/com/android/settings/LocalePicker.java", "com.android.internal.app.LocalePicker" might help, and in the "platform/frameworks/base/core/java/com/android/internal/app",
有一个名为“updateLocale”的函数,我想它可能会有所帮助,但是诸如“IActivityManager”之类的类会在Eclipse中导致编译错误。
有人有什么想法吗?谢谢!
try this
String languageToLoad = "zh";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, null);
Android 清单:
add android:configChanges="locale"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)