private void setRightCameraOrientation(int cameraId, Camera mCamera) {CameraInfo info = new android.hardware.Camera.CameraInfo();Camera.getCameraInfo(cameraId, info);int rotation = this.getWindowManager().getDefaultDisplay().getRotation();int degrees = 0;switch (rotation) {case Surface.ROTATION_0:degrees = 0;break;case Surface.ROTATION_90:degrees = 90;break;case Surface.ROTATION_180:degrees = 180;break;case Surface.ROTATION_270:degrees = 270;break;}//int result;if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {result = (info.orientation + degrees) % 360;result = (360 - result) % 360; // compensate the mirror} else { // back-facingresult = (info.orientation - degrees + 360) % 360;}mCamera.setDisplayOrientation(result);}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android(安卓)CursorLoader相关
  2. Android(安卓)性能最佳实践 1
  3. Android摄像头开发:拍照后添加相框,融合相
  4. 团体项目(饱了嘛)_第一组_原型设计报告
  5. 国内有米广告详解
  6. CircularTools view渐变呈现效果
  7. android 右上角menu创建设置
  8. (Mac)反编译Android(安卓)APK详细操作指
  9. 给其他布局文件的控件添加监听事件
  10. 浅谈WEB页面工具语言XML(二)定义