如何在没有Intent的情况下改变android中整个系统的语言设置?

如何在没有Intent的情况下改变android中整个系统的语言设置?,第1张

概述我正在尝试在我的应用程序上更改整个AndroidPhone系统的语言,因为我们的目标是自定义一个Settings应用程序.我试过这个,但没有用:Configurationconf=Resources.getSystem().getConfiguration();conf.locale=toSet;/oSetisaLocalewhichIwanttosettothesyst

我正在尝试在我的应用程序上更改整个Android Phone系统的语言,因为我们的目标是自定义一个Settings应用程序.

我试过这个,但没有用:

Configuration conf = Resources.getSystem().getConfiguration();conf.locale = toSet;  //toSet is a Locale which I want to set to the systemconf.setToDefaults();

另一个尝试也没有工作:

Locale.setDefault(toSet)

有一些方法可以改变应用程序的语言,但不能改变系统.

有什么方法可以达到目标吗?
获得root权限对我有用吗?
或者有什么方法可以修改Intent-Activity的UI界面吗?

我发现,在源代码中,“platform / packages / apps / Settings / src / com / androID / settings / LocalePicker.java”,“com.androID.internal.app.LocalePicker”可能有所帮助,并在“platform / frameworks / base / core / java / com / androID / internal / app”,有一个名为“updateLocale”的函数,我猜它可能会有所帮助,但是像“IActivityManager”这样的类会导致Eclipse中的编译错误.

有没有人有任何想法?谢谢!

解决方法:

试试这个

String languagetoLoad = "zh";  Locale locale = new Locale(languagetoLoad);  Locale.setDefault(locale);  Configuration config = new Configuration();  config.locale = locale;  getBaseContext().getResources().updateConfiguration(config, null);

AndroIDManifest:

添加androID:configChanges =“locale”

总结

以上是内存溢出为你收集整理的如何在没有Intent的情况下改变android中整个系统的语言设置?全部内容,希望文章能够帮你解决如何在没有Intent的情况下改变android中整个系统的语言设置?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1116911.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存