Frequently asked questions
Q.1) We know how to animate widgets now, but what about shapes or images that I create myself?
A) An ImageView
widget can hold any image you like. Just add the image to the drawable
folder and then set the appropriate src
attribute on the ImageView
widget. You can then animate whatever image is being shown in the ImageView
widget.
Q.2) But what if I want more flexibility than this, more like a drawing app or even a game?
A) To implement this kind of functionality, we will need to learn about another general computing concept known as threads, as well as some more Android classes (such as Paint
, Canvas
, and SurfaceView
). We will learn how to draw anything from a single pixel to shapes, and then move them around the screen, starting in the next chapter, Chapter 20, Drawing Graphics.