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