setPreviewDisplay与setPreviewTexture [英] setPreviewDisplay vs setPreviewTexture
问题描述
打开Android相机时,必须分别使用setPreviewDisplay()
(API级别1)或setPreviewTexture()
(API级别11)将SurfaceHolder或OpenGL SurfaceTexture设置为容纳显示的图像.两者之间在速度,设备兼容性(除了API级别)或图像质量方面是否有任何区别?
When opening the Android camera, either a SurfaceHolder or an OpenGL SurfaceTexture must be set to hold the displayed images, using setPreviewDisplay()
(API level 1) or setPreviewTexture()
(API level 11), respectively. Is there any difference in speed, device compatibility (aside from API level), or image quality between the two?
推荐答案
每当您使用SurfaceView
打开相机时,您都会看到一点滞后并在屏幕上闪烁.这是因为SurfaceView
创建了一个新的单独窗口,在其中TextureView
(在API级别14中添加了)不会创建新窗口,而是充当普通视图,因此,在打开相机时,您不会看到任何滞后或闪烁TextureView
.
这更多是性能问题.
Whenever you use SurfaceView
to open camera, you can see a little lag and blink in screen. This is because, SurfaceView
creates a new separate window where in TextureView
(added in API level 14) does not create new window but acts as normal view, so, you won't see any lag or blink while opening camera using TextureView
.
This is more of a performance issue.
有关更多信息,请在此处.
这篇关于setPreviewDisplay与setPreviewTexture的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!