在运行时改变方向 [英] Change orientation at runtime
本文介绍了在运行时改变方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新到Android我的问题是,是否有可能以编程方式改变方向?如果是的话,我们该怎么办呢?
解决方案
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
此外,在您的清单文件中添加此(下活动):
安卓configChanges =方向
I'm new to android my question is, Is it possible to change orientation programmatically? If yes, how can we do that?
解决方案
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Also add this in your manifest file (under activity):
android:configChanges = "orientation"
这篇关于在运行时改变方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文