android camera方向的确定 android中前后camera预览和拍照时方向是根据什么确立的?还有横或竖着拿手机时的方向? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void setDisplayOrientation(Context context){ int rotation = ((Activity) context).getWindowManager() .getDefaultDisplay().getRotation(); int degree = 0; switch (rotation) { case Surface.ROTATION_0: degree = 0; break; case Surface.ROTATION_90: degree = 90; break; case Surface.ROTATION_180: degree = 180; break; case Surface.ROTATION_270: degree = 270; break; } int result; CameraInfo info = new CameraInfo(); //Camera.getCameraInfo(mBackCameraId, info); Camera.getCameraInfo(0, info); if(info.facing == CameraInfo.CAMERA_FACING_FRONT){ result = (info.orientation + degree) % 360; result = (360 - result) % 360; }else{ result =(info.orientation - degree + 360 ) % 360; } mCamera.setDisplayOrientation(result); Log.v("shenwenjian","result:"+result); pictureOrientation = result; } Camera的setDisplayOrientation方法注解上有现成代码可用,和2楼的方法一样,楼主多看API 关于照片预览的方向 是exif 信息的事情。你可以google一下 android exif 就OK了 不知道现在有没有Libgdx的中文文档,如果没有我去翻译一个 android工程运行是如何指定初始页面的? 求助:google play 上传apk乱码问题 WebView如何使配置 啊 有点乱,关于游戏开发中线程使用的问题 怎么在SIM卡中存入中文和英文 main.xml报错! 'menu/Xml' is not open android 手机为什么发送 “GET / HTTP/1.1” TCP网络数据呢?程序设计没发送啊 Android播放器问题!急,在线等~~ singleInstance下切换时会出现黑屏。 android会限制播放flash访问视频吗?
int rotation = ((Activity) context).getWindowManager()
.getDefaultDisplay().getRotation();
int degree = 0;
switch (rotation) {
case Surface.ROTATION_0: degree = 0; break;
case Surface.ROTATION_90: degree = 90; break;
case Surface.ROTATION_180: degree = 180; break;
case Surface.ROTATION_270: degree = 270; break;
}
int result;
CameraInfo info = new CameraInfo();
//Camera.getCameraInfo(mBackCameraId, info);
Camera.getCameraInfo(0, info);
if(info.facing == CameraInfo.CAMERA_FACING_FRONT){
result = (info.orientation + degree) % 360;
result = (360 - result) % 360;
}else{
result =(info.orientation - degree + 360 ) % 360;
}
mCamera.setDisplayOrientation(result);
Log.v("shenwenjian","result:"+result);
pictureOrientation = result;
}