Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between SurfaceView and ImageView

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.

like image 202
Gomu Avatar asked Feb 13 '23 18:02

Gomu


2 Answers

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.

like image 71
MysticMagicϡ Avatar answered Feb 15 '23 11:02

MysticMagicϡ


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.

like image 38
Govind Avatar answered Feb 15 '23 10:02

Govind