纵向使用摄像头纵向、摄像头

2023-09-04 05:37:53 作者:柒予

我想开发一个应用程序,它使用相机。到目前为止,它一直运作良好,但我不能强迫方向为纵向。它似乎运作良好,如果我强迫所有的活动,以山水,因为相机preVIEW似乎适合风景线。

I'm trying to develop an app which uses the Camera. So far it's been working well, except that I'm unable to force the orientation to be "portrait". It seems to work well if I force all activities to "landscape", because the camera preview seems to fit in landscape.

反正是有使用相机在人像模式?

Is there anyway to use the Camera in portrait mode?

推荐答案

Android设备V2.2及以上遏制和API来旋转显示为纵向。低于2.2设备仅景观。最好的办法是,以检测设备是2.2和旋转90度。在2.2依傍山水的设备。好消息是大多数Android设备都在2.2以上。

Android devices v2.2 and above contain and API to rotate the display to portrait. Devices below 2.2 are landscape only. Your best bet is to detect if the device is 2.2 and rotate 90 degrees. Fall back on landscape for devices under 2.2. The good news is most Android devices are on 2.2 and above.

看看我的答案在这里更多的信息:

Check out my answer here for more info:

Camera是错误的,除非键盘打开