The words written in the front

Said to open a new pit is not actually, before also simply sent some articles about custom View, before also tun a big wave of articles, but the content is superficial, not in-depth to study some custom View related details, 2020 is also coming to the end of the year, Google is also testing out a new UI construction method called Compose, so if you don’t summarize your existing custom View, you probably won’t get a chance to Compose it.

You might say, well, Compose will replace the existing UI architecture, so why bother with the existing View architecture?

Admittedly, I had this concern before I planned to organize and study custom Views (after all, I’ve only been working on Android for a little over a year, so MAYBE I should learn more now instead of rushing to summarize), but as the front end of Android, after all, it is the front end, and among other things, View is a system that is directly presented to users, If you don’t have a deep understanding, how can you give users a superior experience?

On the other hand, there are certainly many points that cannot be deeply explored by individuals to make a technical summary. Releasing this part of the summary can help us learn and make progress together.

At the end of the previous words, I will refer to a lot of big guys’ articles and videos for technical summary. I will not be the porter of the code directly, but all the code will be re-verified by myself. If there is infringement or make big guys feel uncomfortable, please contact me. I will also carefully correct the relevant knowledge of mathematics and physics. If there is any mistake, please contact me and I will correct it carefully.

Note that all demos in this series will be written in Kotlin, based on Android 6.0 and above.

Why do this series

About the custom View in the Android development foundation is inevitable to escape a topic, not only in the interview is a common question used to test the basic skills of a basic programmer, in the actual development process will also be often used.

Most of the time, we only stay on the surface of the custom View knowledge, without a good understanding of the principle, which leads to we will often review this part of the knowledge, which causes a waste of time, API can not remember, but the principle must be known.

It’s not that I don’t have enough time, it’s just that I’ve done too many repetitive things, and I hope my summary can help save time effectively.

Project catalogue

Mainly from View system measurement, drawing, touch feedback three parts to analyze the Android existing View system of the deep knowledge points, the specific plan is as follows (will be updated, the existing does not represent the final structure) :

  • Basic knowledge of
    • Coordinate system
    • Radians and angles
    • size
    • color
    • The text
  • Advanced knowledge
    • View system in Android
    • Custom View creation (constructor)
    • Bitmap and drawable
    • Physics of animation
    • Drawing process
    • Event distribution mechanism
  • Drawing process
    • measurement
    • layout
    • draw
    • Layout and measurement practice I
    • Layout and measurement practice II
    • Layout and measurement practice III
  • Draw the relevant
    • Canvas
    • Paint
    • Path
    • Bitmap
    • Drawable
    • Matrix
    • Picture
  • animation
  • Touch feedback

Note: I may not release it exactly in this order, or I may skip to study it. If you think my research is ok for you, and there are aspects that you are interested in at present, you can also send me a message. I will give priority to the exploration of that part as far as I can.