Android Canvas Drawing series (i)

Source: Internet
Author: User

First explain: Canvas,Paint , Rect.

Canvas drawing has three main points (you can completely open the brain hole):

1.Canvas Canvas, just like the paper we use for drawing. The graphic is drawn on top of the canvas canvas.

2.paint brush, like a real brush, you can set the color, font, transparency and so on.

3.rect painting path for drawing different shapes such as rectangles, ellipses, etc.


This is mainly about the OnDraw in the view of the canvas parameters, as for the artboard and the like.

The parent class is often overridden in a custom control OnDraw to change the view's properties.


The OnDraw method in view source code is as follows:

protected void OnDraw (canvas canvas) {   }

The OnDraw method in View.java source code is protected, which is obviously used for subclass rewrite.

The comments in the official documentation for this method are:

Implement this to do your drawing (here for drawing view)

the comments for canvas canvas are: the canvas on which the background'll be drawn (the canvas of the current view)

The summary is to draw the current view in this method and canvas for the current view



Android Canvas Drawing series (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.