Difference between SurfaceView and ImageView

浪子不回头ぞ 提交于 2019-12-20 00:43:07

问题


I would like to know what is the difference between SurfaceView and ImageView and their usage scenarios. Both seem to be the same. Kindly direct me if there are proper links which I had probably missed.


回答1:


Some advantages and differences of a surface view:

  1. Better rendering mechanism. threads can update the surface's content without using a handler. This helps for better performance in games and too much animation. So if you need to update GUI rapidly or if the rendering takes too much time and affects user experience then Surfaceview is advisable instead of imageview.

  2. Surfaceviews cannot be transparent, they can only appear behind other elements in the view hierarchy.

  3. Surfaceview has dedicated buffer, too. So it costs more resources than imageview and other views.

Here is a reference links which you could refer to understand better.

Difference between SurfaceView and View?

Hope this clears some doubt.




回答2:


Basically the difference lies on how both the views are being processed internally.

Surface View, has more rendering options. The view implicitly can render the images or animations using the graphics hardware. It doesn't need any third party support ( or makes less use of ) to make the animation work.

Preferably used when you want too many animations to be used. The View renders them automatically to the screen size. Ex: gaming applications.

Image View, is preferably when you want to display more of static images. The View render the images to any layout size. But when you have any animations on the page, the View takes support of GUI related conversions.



来源:https://stackoverflow.com/questions/24198359/difference-between-surfaceview-and-imageview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!