1<HTML>
2<BODY>
3<p>
4The widget package contains (mostly visual) UI elements to use
5on your Application screen. You can also design your own.
6</p>
7
8<p>
9To create your own widget, extend {@link android.view.View} or a subclass. To
10use your widget in layout XML, there are two additional files for you to
11create. Here is a list of files you'll need to create to implement a custom
12widget:
13</p>
14<ul>
15<li><b>Java implementation file</b> - This is the file that implements the
16behavior of the widget. If you can instantiate the object from layout XML,
17you will also have to code a constructor that retrieves all the attribute
18values from the layout XML file.</li>
19<li><b>XML definition file</b> - An XML file in res/values/ that defines
20the XML element used to instantiate your widget, and the attributes that it
21supports. Other applications will use this element and attributes in their in
22another in their layout XML.</li>
23<li><b>Layout XML</b> [<em>optional</em>]- An optional XML file inside
24res/layout/ that describes the layout of your widget. You could also do
25this in code in your Java file.</li>
26</ul>
27
28<p>
29ApiDemos sample application has an example of creating a custom layout XML
30tag, LabelView. See the following files that demonstrate implementing and using
31a custom widget:
32</p>
33<ul>
34    <li><strong>LabelView.java</strong> - The implementation file</li>
35    <li><strong>res/values/attrs.xml</strong> - Definition file</li>
36    <li><strong>res/layout/custom_view_1.xml</strong> - Layout file</li>
37</ul>
38</BODY>
39</HTML>
40