There are two methods in View for drawing. One is onDraw(Canvas canvas) and the other is draw(Canvas canvas). onDraw() is being called by the system and draw() is for manual drawing. How can I use draw(Canvas canvas)? How can I get canvas? Do I create Canvas canvas=new Canvas()?
You should not call or implement the draw() function. If you look at the source code (http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/view/View.java;hb=refs/heads/donut-release) you’ll see that the draw() method does a few things like drawing the background and handling fade, then calls your onDraw() function. All your real drawing calls should be in your onDraw() function.
|You must be logged in to comment|