Sunday, April 20, 2014

canvas, how to achieve the pause function.


A canvas on the thread of control is constantly refreshed drawing, how to achieve tap the screen pause after drawing, and then click again to continue drawing. (Because there are many elements on the canvas, complex combinations, it is impossible to set a flag = true after clicking through the screen, and then write code to determine whether to increase its own radius, or increase the width of the rectangle heterogeneous, it is possible from the Activity What's the life cycle, pause it?)
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Try clicking on the screen can be suspended when, in the foreground painted a translucent pause button, so the back of the Activity will onPause (), you can stop painting onPause (), the continued painting in onResume () inside.

No comments:

Post a Comment