我正在做一个程序,我们正在使用相机拍摄照片并将其存储在私人文件夹中。从中获取图像并将其显示在网格视图中。单击网格视图时显示全屏图像。 我面临的问题是当相机处于肖像模式时,图像质量是完美的。但是如果相机处于横向模式,它会显示拉伸的图像我如何克服这一点。麻烦在显示图像
Q
麻烦在显示图像
0
A
回答
1
嗨看看下面的代码。在保存拍摄的图像之前,请执行以下步骤。它将以纵向模式保存图像。希望这会帮助你。
int rotation = -1;
rotation = ((WindowManager)getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay().getOrientation();
Matrix rotator = new Matrix();
switch (rotation) {
case (Surface.ROTATION_0):
break;
case (Surface.ROTATION_90):
rotator.postRotate(270);
break;
case (Surface.ROTATION_180):
rotator.postRotate(180);
break;
case (Surface.ROTATION_270):
rotator.postRotate(90);
break;
// screen_{width,height} are applied before the rotate, so we don't
// need to change them based on rotation.
bmp_ss = Bitmap.createBitmap(bmp_ss, 0, 0, screen_width, screen_height, rotator, false);
+0
whats rotation hhere – achu
+0
看到我编辑的答案。 – itsrajesh4uguys
相关问题
- 1. 麻烦在显示图像的datagridview
- 2. Compojure显示图像的麻烦
- 3. 麻烦图像
- 4. CSS显示麻烦
- 5. 麻烦显示webview
- 6. webforms中的图表控制麻烦,图像没有显示
- 7. 麻烦CAEmitterLayer显示颗粒
- 8. CSS背景图像麻烦
- 9. 麻烦与图像库jquery
- 10. PHP图像上传麻烦
- 11. SVG图像转换麻烦
- 12. 与图像IE8麻烦
- 13. 麻烦读取的图像
- 14. 麻烦blitting图像pygame
- 15. 显示图像文件路径的麻烦
- 16. 显示图像与画布标签麻烦
- 17. 画布选项卡麻烦显示图像
- 18. 麻烦在html中显示json对象
- 19. 麻烦图像在PHP/MySQL的上传
- 20. 麻烦在css边界图像
- 21. 麻烦背景图像出现在HTML
- 22. 麻烦保存图像上传在php
- 23. Angular 2麻烦显示内容
- 24. 隐藏后显示Javascript的麻烦
- 25. 角js麻烦显示div元素
- 26. 麻烦显示了相同的号码
- 27. 麻烦IIS显示Web应用程序
- 28. 显示自定义JComponent的麻烦
- 29. 随机麻烦显示随机链接
- 30. 显示/隐藏“div”JS的麻烦;
检查图像的分辨率要显示。如果高度大于宽度,则以纵向模式显示图像。否则以横向模式显示图像。这对你有帮助吗? – WELLCZECH
不可能我想以纵向模式显示图像iitself – achu
ImageView无法检测图像是否被捕获到纵向或横向。 ImageView只能管理如何在提供的空间中显示图像(填充,适合,...) – WELLCZECH