Drawing with canvas and paint

So far, we have been using the Android Studio UI designer to implement all aspects of our interface with which our users interact.

If we want smooth-moving customized graphics, then we need to move away from predefined UI widgets.

We are going to need to start looking at and designing with individual pixels and lines. Fortunately, as you might have guessed, Android has some classes to make this nice and easy for us. We will be learning how to get started with the Canvas and Paint classes.

To achieve this, we will learn about the coordinate system that we use to draw our pixels and lines. Then, we will look at the Paint and Canvas classes themselves.

The Android coordinate system

A pixel is the smallest graphical element ...

Get Android Programming for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.