简体   繁体   English

以编程方式添加configChanges =“ locale”

[英]Adding configChanges =“locale” programmatically

I use configChanges="locale" on my activities. 我在活动中使用configChanges =“ locale”。 Without this options in AndroidManifest.xml in 2.x , I am getting flickering screens. 如果在2.x AndroidManifest.xml中没有此选项,则屏幕会闪烁。

It works in all my activities except in the preferences screen in which I have added programmatically. 它可用于我的所有活动,但在以编程方式添加的首选项屏幕中除外。 I have one Preference Activity --> It works after setting configChanges="locale" to the AndroidManifest.xml. 我有一个首选项活动->在将configChanges =“ locale”设置为AndroidManifest.xml后可以使用。

Inside of the Preference Activity, I add programmatically a new preferencescreen. 在“首选项活动”内部,以编程方式添加了一个新的“首选项”屏幕。 For this new PreferenceScreen, I don't have an activity in the AndroidManifest.xml! 对于此新的PreferenceScreen,AndroidManifest.xml中没有活动! So I cannot add the configChanges="locale" and the screen flickers on 2.x !! 所以我无法添加configChanges =“ locale”,并且屏幕在2.x上闪烁!

How can I add the attribute configChanges="locale" programmatically? 如何以编程方式添加属性configChanges =“ locale”?

I have not found a solution to add configChanges="locale" programmatically, but i created a new Pereference Activity and added the configChanges keyword to the Manifest file. 我还没有找到以编程方式添加configChanges="locale"方案,但是我创建了一个新的Pereference Activity并将configChanges关键字添加到清单文件中。

Now it works as it should. 现在它可以正常工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么不为android:configChanges =“ locale”调用onConfigurationchanged? - why onConfigurationchanged is not called for android:configChanges=“locale”? 将android:configChanges添加到生成的清单 - Adding android:configChanges to generated manifest Android:在4.2 Jellybean上,“ android:configChanges”不适用于语言环境更改 - Android: On 4.2 Jellybean “android:configChanges” not working for locale change 以编程方式设置语言环境 - Set Locale programmatically 以编程方式设置区域设置不起作用? - Setting Locale Programmatically not working? 在 Kotlin 中以编程方式更改语言环境 - Change locale programmatically in Kotlin 使用ActionBarActivity和SupportActionBar以编程方式更改区域设置 - Change Locale programmatically with ActionBarActivity and SupportActionBar Android - 以编程方式更改应用程序区域设置 - Android - Change application locale programmatically 在 AndroidManifest.xml 中添加 android:configChanges=“orientation|screenSize”后,横向布局没有改变 - Orientation Layout not changing for landscape after adding android:configChanges=“orientation|screenSize” in AndroidManifest.xml Locale以编程方式更改,但app在Android 2.3.3上的系统默认语言环境中显示 - Locale changed programmatically, but app show in System default locale on Android 2.3.3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM