强制相机总是在Android开放肖像模式 [英] Force a camera to always open in portrait mode in android

查看:126
本文介绍了强制相机总是在Android开放肖像模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时可以打开摄像头意图安卓仅在人像模式,也就是即使用户翻转装置,相机仍然会在纵向模式下,

Is it possible to open the Camera Intent in android in only portrait mode, that is even if the user flipped the device, the camera will still be in portrait mode,

我尝试了以下的答案:强制人像模式,但没有工作,谢谢

I tried the following answer: Force Portrait Mode but didn't work, Thanks

推荐答案

随着API的LVL 8,这是可用的:

As of API lvl 8, this is available:

公众最终无效setDisplayOrientation(INT度)

public final void setDisplayOrientation (int degrees)

即。与波泰特在清单:

public void surfaceCreated(SurfaceHolder holder) {
    mCamera = Camera.open();
    mCamera.setDisplayOrientation(90);

请参阅本链接相机

这篇关于强制相机总是在Android开放肖像模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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