简体   繁体   English

Android Camera Preview不是全屏

[英]Android Camera Preview not Full Screen

I am developing a camera app but the camera is not full screen. 我正在开发相机应用程序,但是相机不是全屏的。 I am using common "CameraPreview" class to open camera. 我正在使用常见的“ CameraPreview”类打开相机。 it includes Surfaceview and Determining Optimal Size for camera. 它包括Surfaceview和确定相机的最佳尺寸。 In tablet and phones, camera is not full screen. 在平板电脑和手机中,相机未全屏显示。 For example, tablet size is 1280x728 but camera size is 1024x768. 例如,平板电脑尺寸为1280x728,而相机尺寸为1024x768。 It is shown in FrameLayout for which layout widht and height is FillParent. 它显示在FrameLayout中,其布局宽度和高度均为FillParent。 I could not understand and solve this issue. 我无法理解并解决此问题。 I wanna open camera in full screen without stretching. 我想全屏打开相机而不会拉伸。

Is there anybody got this issue and fix it? 是否有人解决此问题?

Judging by the code here :(which you can use actually), you can use the method getSupportedPreviewSizes() and see what are the supported resolutions, 1024x768 could easily be the highest one available for this preview and as you found out, it is really the highest supported. 这里的代码判断(您可以实际使用),您可以使用方法getSupportedPreviewSizes()并查看支持的分辨率, 1024x768可能是该预览版可用的最高分辨率,并且您发现它确实是最高支持。

So those are the supported resolutions, there's no way you can get higher than the supported. 因此,这些是受支持的分辨率,您无法获得比受支持的更高的分辨率。 You must find a workaround for this, like to put the preview in the center and surrond it with black frame or something like that. 您必须为此找到一种解决方法,例如将预览放在中间并用黑框或类似的东西替代。

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

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