有时候我们想根据自己的需要调整下Camera的预览方向,那么是调用哪个API可以达到我们的目的呢?
我们看下下图拍的几张小可爱的照片,分别是正常方向、旋转180度、90度拍的照片。
一、Camera API
Camera1上,我们可以通过setDisplayOrientation(int degress);来设置camera预览的方向。
mCamera.setDisplayOrientation(Surface.ROTATION_180);
这里也贴下源码里面关于setDisplayOrientaion接口的详细说明。
/**
* Set the clockwise rotation of preview display in degrees. This affects
* the preview frames and the picture displayed after snapshot. This method
* is useful for portrait mode applications. Note that preview display of
* front-facing cameras is flipped horizontally before the rotation, that
* is, the image is reflected along the central vertical axis of the camera
* sensor. So the users can see themselves as look