Normal controls
1. Inherit the view class or its subclasses, and rewrite the public Myviewdemo (context context, AttributeSet Attrs) construction method.
2. Override the Onmeasure method to set the size of the control
3, rewrite the OnDraw method, implement the control drawing
4. Add the custom control to the layout file. Note that it is a full class name
To add a property control
1. Inherit the view class or its subclasses, and rewrite the public Myviewdemo (context context, AttributeSet Attrs) construction method.
2. Write the resource file in the value directory
<resources>
<!--Add a property set--
<declare-styleable name= "Theme" >
<!--Add specific properties--
<attr name= "Colorforeground" format= "Color"/>
</declare-styleable>
</resources>
3. Parse the XML file in the constructor method.
4. Override the Onmeasure method to set the size of the control
5, rewrite the OnDraw method, implement the control drawing
6. Add the named control of the custom control to the layout file:
xmlns:example= "http://schemas.android.com/apk/res/Package name"
7. Add the custom control to the layout file. Note that it is a full class name
Basic steps for Android custom controls