我的应用程序的格式是所有在纵向模式。奇怪的是,当我卡在纵向模式中的照片,它是在ImageView的侧身显示的(就像是在景观抢购)......它显示右侧的唯一方法是,如果我在捕捉风景模式的照片。

一个简单的解决方法的

人知道显示照片骑侧朝上,而不管相机的取向的?我可以很容易地提供我的代码,如果有人需要去看看。

谢谢!

有帮助吗?

解决方案

下面是我用onActivityResult()的代码在我的活性。返回的意图是为挑选类型image / *的图像。很适合我!

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);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top