setPreviewDisplay与setPreviewTexture [英] setPreviewDisplay vs setPreviewTexture

查看:1436
本文介绍了setPreviewDisplay与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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆