Search code examples
androidviewimageviewlayer

Which Framework can be used to draw a complex, interactive UI hierarchy on Android? (Like CoreAnimation on iOS)


I'm porting a vector graphics editor from iOS to Android. The app must draw a complex hierarchy of graphical objects in an efficient manner, so that the graphics can be edited with gestures in real time. The edited work commonly consists of images, text and graphical primitives (lines, circles etc.). UI elements like selection highlights are rendered on a separate layer on the top.

On the iOS app, if one component of the graphic changes (for example a small text element changes its content), only that text element is re-rendered.

On iOS, we use CALayer objects from the CoreAnimation framework. This works very well. What framework can be used on Android for this use case? Is there an established "native" way to do that, or are usually third party frameworks used?


Solution

  • Android does not have similar thing out of the box. We do have core.animation but it is limited to simple behavioral animations. To create what you want you need to use SurfaceView or GLSurfaceView and help of clean OpenGL. You may also try to use ordinary Canvas of View - you will have limited possibilities though.

    Also there are wrapper around OpenGl and SurfaceView like libgdx it is used mostly for games though - so it has much wider possibilities than you need, but it is less complicated than OpenGl.

    Hope it helps.