入门相机总是返回抓拍照片右侧朝上? [英] Getting camera to always return a snapped photo right side up?
问题描述
我的应用程序的格式都在肖像模式。奇怪的是,当我扣在纵向模式中的照片,它显示在横盘(就像是在景观抢购)的ImageView的......它显示右侧的唯一方法是,如果我在捕捉风景模式的照片。
The format of my app is all in portrait mode. Oddly, when I snap a photo in portrait mode, it is displayed on the ImageView sideways (like it was snapped in landscape)...the only way it is displayed right side up is if I snap the pic in landscape mode.
任何人都知道一个简单的解决方法,显示照片骑的一面朝上,无论相机的方向?我可以很容易地提供我的code。如果有人需要去看看。
Anyone know of a simple workaround that displays the photo ride side up, regardless of the camera's orientation? I can easily provide my code if anyone needs to take a look.
谢谢!
推荐答案
下面是code我用的onActivityResult()在我的活动。返回的意图是用于拾取所述类型的图像/ *的图像。很适合我!
Here is the code I used onActivityResult() in my activity. The intent returned was for picking an image of the type image/*. Works well for me!
Uri imageUri = intent.getData();
String[] orientationColumn = {MediaStore.Images.Media.ORIENTATION};
Cursor cur = managedQuery(imageUri, orientationColumn, null, null, null);
int orientation = -1;
if (cur != null && cur.moveToFirst()) {
orientation = cur.getInt(cur.getColumnIndex(orientationColumn[0]));
}
Matrix matrix = new Matrix();
matrix.postRotate(orientation);
这篇关于入门相机总是返回抓拍照片右侧朝上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!