如何在运行时锁定方位 [英] How to lock orientation during runtime

查看:187
本文介绍了如何在运行时锁定方位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在运行时锁定的方向?例如,我想允许用户锁定屏幕到景观,如果用户当前在景观和切换菜单选项。

解决方案

  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
 

拜会活动,将其锁定为横向。寻找在ActivityInfo类中的其他标志。您可以锁定回纵向或使传感器/滑块驱动的。

这里更多信息: http://www.devx.com/wireless/Article/40792

Is there a way to lock orientation during runtime? For example I'd like to allow the user to lock the screen to landscape if the user currently in landscape and toggle the menu option.

解决方案

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

Called on an activity, will lock it to landscape. Look for the other flags in the ActivityInfo class. You can lock it back to portrait or make it sensor/slider driven.

More info here: http://www.devx.com/wireless/Article/40792

这篇关于如何在运行时锁定方位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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