编程锁到肖像模式,某些操作 [英] Programmatically lock into portrait mode for certain operations

查看:139
本文介绍了编程锁到肖像模式,某些操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法以编程方式锁定在纵向模式下对某些操作的应用程序,然后再重新开始(并有应用旋转为横向,如果用户持有设备的方式)之后的操作完成?

Is there a way to programmatically lock an app in portrait mode for certain operations, and then resume (and have the app rotate to landscape if the user is holding the device that way) after the operation is complete?

推荐答案

试试这个:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
//Do your operation
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);

这篇关于编程锁到肖像模式,某些操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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