在surfacechange中执行:

int mDisplayRotation = 0;int mDisplayOrientation = getWindowManager().getDefaultDisplay().getRotation() * 90;CameraInfo mCameraInfo = new CameraInfo();Camera.getCameraInfo(Camera.CameraInfo.CAMERA_FACING_BACK, mCameraInfo);int mCameraOrientation = mCameraInfo.orientation;if (mCameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {mDisplayRotation = (mCameraOrientation - mDisplayOrientation + 360) % 360;} else {mDisplayRotation = (mCameraOrientation + mDisplayOrientation) % 360;mDisplayRotation = (360 - mDisplayRotation) % 360;}mCamera.setDisplayOrientation(mDisplayRotation);

更多相关文章

  1. Android(安卓)studio常见错误分析解决
  2. ANDROID 使用 Service 在手机锁屏休眠状态下后台执行发送短信息
  3. RN 打包流程
  4. Android(安卓)深入研究SQLite实例(二)
  5. Android在onCreate()中获得控件尺寸 (转)
  6. android字体闪烁动画(线程)
  7. Android启动画面Splash
  8. Android中执行adb命令
  9. android字体闪烁动画(线程)

随机推荐

  1. Android学习笔记_72_Spinner的用法
  2. android webview 面试
  3. Android应用程序组件Content Provider的
  4. android获得手机的电量
  5. EditText实时判断输入字符数
  6. Android中创建与几种解析xml的方法!
  7. 一 Android(安卓)O WiFi 框架变化
  8. 浅谈Android的移动存储SharedPreferences
  9. android EditText 添加图片表情以及在四
  10. Ubuntu 12.04.3 64位 安装android sdk完