Learning Java by Building Android  Games
上QQ阅读APP看书,第一时间看更新

Chapter 5. The Android Canvas Class – Drawing to the Screen

While we will leave creating our own classes for a few more chapters our new-found knowledge about methods enables us to start taking greater advantage of the classes that Android provides. This entire chapter will be about the Android Canvas class and some related classes like Paint and Color. These classes combined bring great power when it comes to drawing to the screen. Learning about Canvas will also teach us the basics of using any class.

In this chapter, we will:

  • Talk about understanding the Canvas and related classes
  • Write a Canvas based demo app as practice before moving on to Sub' Hunter
  • Look at the Android coordinate system so we know where to do our drawing
  • Draw some graphics and text for the Sub' Hunter game

Let's draw!