简体   繁体   English

Camera2 API:保持自动旋转,但不旋转相机预览和按钮

[英]Camera2 API: Keep autorotation on, but don't rotate camera preview and buttons

I am looking for a solution to keep the SCREEN ORIENTATION in auto mode, but that the preview of the camera does not rotate. 我正在寻找一种将SCREEN ORIENTATION保持在自动模式的解决方案,但是相机的预览不会旋转。 Any suggestions? 有什么建议么?

You need to mention android:screenOrientation="portrait" or android:screenOrientation="landscape" under the activity tag in your manifest file (ie AndroidManifest.xml) if you want to make your activity's orientation fixed (this is the activity in which the preview of camera is being shown by you). 如果您想固定活动的方向(这是指活动所在的方向,则需要在清单文件(即AndroidManifest.xml)中的活动标签下提及android:screenOrientation="portrait"android:screenOrientation="landscape"您正在显示摄像机的预览)。

Like for example - 例如-

<activity
            android:name="com.something.camera.CaptureActivity"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden" />

使用旋转动画SEAMLESS ,并实现横向和纵向UI,以将预览窗口小心地放置在同一位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM