layout-land xml 文件不适用于 onConfigurationChanged 回调
我有不同的纵向和横向模式布局,并且还需要重写 onConfigurationChanged()
回调。但问题是,当我将手机方向更改为横向时,我的横向布局不起作用。
谁能告诉我这是 onConfigurationChanged
回调问题还是其他原因导致的?
任何帮助将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么?
我猜测“不起作用”意味着景观布局没有生效。鉴于您所做的事情,这是预期的行为。
要解决此问题,最好删除
android:configChanges="keyboardHidden|orientation"
。放入该属性应作为最后的手段,通常适用于没有单独的纵向与横向布局文件的活动。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.我相信它绝对会对您有所帮助...
}
并将此行添加到您的清单文件中..
android:configChanges="keyboardHidden|方向"
I am sure that it will definitively help you...
}
and add this line in your manifest file..
android:configChanges="keyboardHidden|orientation"