onConfigurationChanged

onConfigurationChanged

本文介绍了布局土地的XML文件不与onConfigurationChanged通话下班回来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有不同的布局为纵向和横向模式,我也需要重写 onConfigurationChanged()回调。但问题是,当我改变手机方向为横向我的景观布局不工作。

谁能告诉我,这是 onConfigurationChanged 再打问题还是其他什么东西导致的?

任何帮助将AP preciative。

解决方案

为什么?

我要猜测,不工作是指景观布局不生效。这是正常现象给你做了什么。

要解决此问题,最好你删除安卓configChanges =keyboardHidden |定位。把在该属性应作为最后的手段,通常对于不具备独立的纵向与横向布局文件的活动。

I have different layouts for portrait and landscape mode and I also need to override the onConfigurationChanged() callback. But problem is when I change the phone orientation to landscape my landscape layout does not work.

Can anybody tell me is this onConfigurationChanged call back problem or something else causing that?

Any help will be appreciative.

解决方案

Why?

I am going to guess that "does not work" means that the landscape layout does not take effect. This is expected behavior given what you have done.

To resolve this problem, ideally you delete android:configChanges="keyboardHidden|orientation". Putting in that attribute should be done as a last resort, and typically for activities that do not have separate portrait versus landscape layout files.

这篇关于布局土地的XML文件不与onConfigurationChanged通话下班回来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 14:55