I. Custom Component Classification
Customized component: inherits the view and adds more attributes and events. Horizontal scaling
Compound component:
Inherit viewgroup and assemble multiple simple controls into one composite control by layout. Horizontal scaling
Ii. Define component steps
1. Select an inheritance class (it must be a subclass of view or view ).
Class 2 initialization: Initial Value Setting of new property attributes.
3. overload method:
Layout and rendering ondraw (), onmeasure ()
Event (Custom Event) onkeyevent ()... listener/overload Function
Principle]
For this project only, you can use inner class;
If you are planning to release it commercially, you need to use a separate class file;
If you plan to release the product commercially, do not use the XML layout file instead of dynamic code generation;
3. Use Components
[Internal class]
<View
Class = "com. Android. notepad. noteeditor $ myedittext"
Id = "@ + ID/Note"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: Background = "@ Android: drawable/empty"
Android: padding = "10dip"
Android: scrollbars = "vertical"
Android: fadingedge = "vertical"/>
[Non-internal class]
<Com. Android. notepad. myedittext
Id = "@ + ID/Note"
.../>
1. Development of custom components