A SurfaceView
is a custom view in Android that can be used to drawn inside it.
The main difference between a View
and a SurfaceView
is that a View is drawn in the
UI Thread
, which is used for all the user interaction.
If you want to update the UI rapidly enough and render a good amount of information in
it, a SurfaceView is a better choice.
But there are a few technical insides to the SurfaceView
:
1. They are not hardware accelerated.
2. Normal views are rendered when you call the methods invalidate
or postInvalidate()
, but this does not mean the view will be
immediately updated (A VSYNC
will be sent, and the OS decides when
it gets updated. The SurfaceView
can be immediately updated.
3. A SurfaceView has an allocated surface buffer
, so it is more costly