0
android.Camera.Preferences.setRotation documentation1.6至2.1 CameraInfo的替代?
public void onOrientationChanged(int orientation) {
if (orientation == ORIENTATION_UNKNOWN) return;
android.hardware.Camera.CameraInfo info =
new android.hardware.Camera.CameraInfo();
android.hardware.Camera.getCameraInfo(cameraId, info);
orientation = (orientation + 45)/90 * 90;
int rotation = 0;
if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
rotation = (info.orientation - orientation + 360) % 360;
} else { // back-facing camera
rotation = (info.orientation + orientation) % 360;
}
mParameters.setRotation(rotation);
}
是有在API級別5至Camera.CameraInfo的替代方案(或更好,但甚至4)?我試圖設置捕獲的圖像的旋轉,我無法弄清楚如何獲取設備的相機的方向。預先API級別9是所有相機的方向固定或什麼?
查看camerainfo文檔,它不返回屏幕方向,但相機正在觀看的位置http://developer.android.com/reference/android/hardware/Camera.CameraInfo.html#orientation – Hrk 2012-10-26 09:59:15