答案 0 :(得分:0)
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(Camera.CameraInfo.CAMERA_FACING_BACK,info);
int rotation = mActivity.getWindowManager()。getDefaultDisplay()。getRotation(); int degrees = 0;
切换(旋转){
case Surface.ROTATION_0: degrees = 0; break; //Natural orientation
case Surface.ROTATION_90: degrees = 90; break; //Landscape left
case Surface.ROTATION_180: degrees = 180; break;//Upside down
case Surface.ROTATION_270: degrees = 270; break;//Landscape right
}
int rotate =(info.orientation - degrees + 360)%360;
Camera.Parameters params = mCamera.getParameters();
params.setRotation(旋转);
mCamera.setParameters(PARAMS);
您的解决方案是一种变通方法,因为您在已经记录之后修改了图像。这个解决方案更清洁,并不需要所有这些'如果'保存图像前的语句。