gpt4 book ai didi

android - android中的VideoView和TextureView、Suraceview有什么区别?

转载 作者:太空宇宙 更新时间:2023-11-03 10:40:27 25 4
gpt4 key购买 nike

android中VideoView和TextureView、Suraceview有什么区别?

我什么时候使用它们?

最佳答案

抱歉回答晚了,只是偶然发现了这个,但是 TL;DR 答案是这样的:

VideoView -> VideoView 扩展了 SurfaceView,本质上只是 SurfaceView + MediaPlayer。为了您的方便,表面和 MediaPlayer 等的拆卸由小部件负责。

SurfaceView-> 根据 Android 开发人员的说法:

Provides a dedicated drawing surface embedded inside of a view hierarchy. You can control the format of this surface and, if you like, its size; the SurfaceView takes care of placing the surface at the correct location on the screen

The surface is Z ordered so that it is behind the window holding its SurfaceView; the SurfaceView punches a hole in its window to allow its surface to be displayed

这意味着它从 View 层次结构中获取信息来创建连接到 GPU 的专用绘图区域。其缺点是没有动画和过渡等花哨的 View 内容。但性能更高

TextureView -> 来自 Android 开发者:

Unlike SurfaceView, TextureView does not create a separate window but behaves as a regular View. This key difference allows a TextureView to be moved, transformed, animated, etc

你知道了,TextureView 的缺点意味着,由于它是 View 层次结构的一部分,它会在 View 传递期间自行重绘,从而消耗更多资源,但你将具有动画、过渡、alpha 等

关于android - android中的VideoView和TextureView、Suraceview有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35053501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com