Graphics and Custom Views
Thanks to Android’s extensive library, you have dozens of views and widgets at your disposal. If none of these meets your need, you can create a custom view and draw directly on it using the Android Graphics API.
This chapter discusses the use of some members of the Graphics API to draw on a canvas and create a custom view. A sample application called CanvasDemo is presented at the end of this chapter.
The Android Graphics API comprises the members of the android.graphics package. The Canvas class in this package plays a central role in 2D graphics. You can get an instance of Canvas from the system and you do not need to create one yourself. Once you have an instance of Canvas, you can call its various ...