android camera preview方向
16lz
2022-04-24
在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);
更多相关文章
- Android(安卓)studio常见错误分析解决
- ANDROID 使用 Service 在手机锁屏休眠状态下后台执行发送短信息
- RN 打包流程
- Android(安卓)深入研究SQLite实例(二)
- Android在onCreate()中获得控件尺寸 (转)
- android字体闪烁动画(线程)
- Android启动画面Splash
- Android中执行adb命令
- android字体闪烁动画(线程)