简体   繁体   English

Android 调整相机大小预览

[英]Android Resizing Camera Preview

Is there anyway to show the camera preview in an unsupported preview size?无论如何以不受支持的预览尺寸显示相机预览?

The app I'm making requires an image size of 800x480 but the preview needs to be 480x800.我正在制作的应用程序需要 800x480 的图像大小,但预览需要为 480x800。 Is there anyway to do this?有没有办法做到这一点? When I try changing the parameters the image gets squashed and stretched in the preview.当我尝试更改参数时,图像在预览中被压扁和拉伸。

You can only use supported preview sizes.您只能使用支持的预览尺寸。

use:利用:

Parameters params = myCamera.getParameters();

List<Size> previewsizes = params.getSupportedPreviewSizes();

Pick a preview size that is the closest to what you want and use that.选择最接近您想要的预览尺寸并使用它。
It's as close as you can get.它尽可能接近。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM