How to use view. OnDraw (canvas) in Android

How to use view. OnDraw (canvas) in Android

View draw through view. OnDraw (canvas)

We can define our own testview inherited from view, and then overload view. OnDraw (canvas)

How is a custom testview associated with an activity? There are two ways:

For example:

The following is an example of using OnDraw (canvas) to draw a rectangular area and draw text on it (making the program more concise and compact by using internal classes):

The operation effect is as follows:

If you have any questions, please leave a message or go to the community of this site for exchange and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>