安卓改变语言监听器监听器、语言

2023-09-06 08:50:52 作者:你在我眼里比纸还透明

语言可以改变

首页>菜单>设置>语言区域和放大器;文本>选择区域设置

Home > Menu > Settings > Locale & text > Select locale

我想知道我怎么能检测出这种变化?我的应用程序似乎这样的操作过程中要关闭的系统,但是我必须要100%的把握,这是官方的规则。

I am wondering how can I detect such change? My application is seems to be turned off by system during such operation, however I have to be 100% sure, that this is official rule.

你对此有所了解?

推荐答案

http://developer.android.com/guide/topics/manifest/activity-element.html#config说:

安卓configChanges   列出配置更改,该活动将处理本身。当配置更改在运行时发生,该活动被关闭,默认情况下重新启动,但在宣布的配置与此属性将prevent活动被重新启动。相反,该​​活动仍在运行和onConfigurationChanged()方法被调用。

android:configChanges Lists configuration changes that the activity will handle itself. When a configuration change occurs at runtime, the activity is shut down and restarted by default, but declaring a configuration with this attribute will prevent the activity from being restarted. Instead, the activity remains running and its onConfigurationChanged() method is called.

请注意:使用这个属性应避免使用仅作为最后手段。请由于配置改变读取处理运行时更改了有关如何正确处理重新启动的详细信息。

Note: Using this attribute should be avoided and used only as a last-resort. Please read Handling Runtime Changes for more information about how to properly handle a restart due to a configuration change.

以下任何字符串或全部该属性的有效值。多个值之间用| - 例如,区域设置 |网站导航|定位。

Any or all of the following strings are valid values for this attribute. Multiple values are separated by '|' — for example, "locale|navigation|orientation".