Android的:语言环境(系统语言)变化影响我的应用程序布局 [英] Android: locale(system Language) change effect my application layouts

查看:442
本文介绍了Android的:语言环境(系统语言)变化影响我的应用程序布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序,一个活动被打开。我preSS home键和变化的语言,从任务管理器中打开我的应用程序。问题:我的活动布局渐宽

i'm in my app, one activity is opened. I press home button and change language, from taskmanager opens my app. Problem: my activity layout is getting wide.

在androidmanifest变化相对应的活动:

changes in androidmanifest corresponding to that activity:

请注意:如果我添加的语言环境中的Andr​​oid清单,布局是正确的,但语言不获取即时更新。用户必须关闭该活动,然后重新启动,才语言得到更新。

Note: If i add locale in android manifest, layout is proper, but language is not getting updated immediately. User have to close that activity and then restart, only then language is getting updated.

请给我你的投入。

推荐答案

正如对你的问题的意见,这是正常的行为。

As mentioned in the comment on your question, it is normal behaviour.

在语言环境的变化被认为是配置的相同方向的变化等。

A change in Locale is considered a change of Configuration the same as a change in orientation etc.

您需要重写<一个href="http://developer.android.com/reference/android/app/Activity.html#onConfigurationChanged%28android.content.res.Configuration%29"相对=nofollow> onConfigurationChanged 在活动,并从那里重新加载一切。

You need to override onConfigurationChanged in your Activity and reload everything from there.

请注意:您还需要指定安卓configChanges =区域设置活动声明中 AndroidManifest 文件。

NOTE: You will also need to specify android:configChanges="locale" in the Activity declaration in the AndroidManifest file.

这篇关于Android的:语言环境(系统语言)变化影响我的应用程序布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆