Android SurfaceView vs TextureView
2015-08-23 11:19
330 查看
This page is intended to briefly introduce the differences between SurfaceView and TextureView.
SurfaceView 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. Its behavior is more or less similar as an onscreen Window on a traditional desktop system, for example, XWindow on X11 system which can be frameless and embedded inside another XWindow.
The followings are two limitations of SurfaceView:
You can not be animated, transformed and scaled;
You can not overlay two SurfaceView.
TextureView looks like a general View. You can animate, transform and scale it, just like a TextView. TextureView can only be used in a hardware accelerated window. However, TextureView will consume much more memory than SurfaceView, and also may have a 1~3 frame latency. See the discussion on [3]
You want to make XWalkView can be animated and transformed, or
You want to overlay two XWalkViews
by setting the boolean flag ANIMATIBLE_XWALK_VIEW to true for TextureView usage.
http://developer.android.com/reference/android/view/SurfaceView.html
http://developer.android.com/reference/android/view/TextureView.html
https://groups.google.com/a/chromium.org/forum/#!topic/graphics-dev/Z0yE-PWQXc4
SurfaceView and TextureView
Both SurfaceView and TextureView are inherited from android.view.View class. They can be drawn and rendered from a separate thread, which is the major difference from other views. The feature of drawing separately is employed by Crosswalk to improve rendering performance greatly by a dedicated GPU thread.SurfaceView 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. Its behavior is more or less similar as an onscreen Window on a traditional desktop system, for example, XWindow on X11 system which can be frameless and embedded inside another XWindow.
The followings are two limitations of SurfaceView:
You can not be animated, transformed and scaled;
You can not overlay two SurfaceView.
TextureView looks like a general View. You can animate, transform and scale it, just like a TextView. TextureView can only be used in a hardware accelerated window. However, TextureView will consume much more memory than SurfaceView, and also may have a 1~3 frame latency. See the discussion on [3]
Use Animitable XWalkView
Crosswalk Embedding API for Android supports both SurfaceView and TextureView very well. The XWalkView uses SurfaceView as default, but it allows your to use TextureView as well in case of:You want to make XWalkView can be animated and transformed, or
You want to overlay two XWalkViews
by setting the boolean flag ANIMATIBLE_XWALK_VIEW to true for TextureView usage.
http://developer.android.com/reference/android/view/SurfaceView.html
http://developer.android.com/reference/android/view/TextureView.html
https://groups.google.com/a/chromium.org/forum/#!topic/graphics-dev/Z0yE-PWQXc4
相关文章推荐
- Android 屏幕大小限制说明
- Android之使用MediaMetadataRetriever类获取媒体信息
- Android笔记三
- android 中SQLite数据库多条插入提高执行效率
- android studio升级到23.0产生的问题s
- android service
- ImageView.ScaleType设置图解
- Android笔记二
- Android 快速开发系列 打造万能的ListView GridView 适配器
- Android 联系人数据库介绍以及对联系人的基本操作
- Android 中的 Service 全面总结
- Android:java.lang.SecurityException: Permission Denial解决办法
- 每个Android开发者应该知道的6个SDK和API
- (Android)Vuforia Native版本与jpct-ae结合
- Andriod学习系列之(四)Intent初涉
- 自定义Dialog实现从下往上出现(内容省市县三级联动)
- Android学习笔记(一)Android应用程序的组成部分
- 列出android所有服务
- Android AOSP源码下载
- Android Fragment(三)---生命周期与回退栈