Home | History | Annotate | Download | only in view
      1 <html>
      2 <head>
      3 <link rel="stylesheet" type="text/css" href="assets/style.css" />
      4 <script type="text/javascript" src="http://www.corp.google.com/style/prettify.js"></script>
      5 <script src="http://www.corp.google.com/eng/techpubs/include/navbar.js" type="text/javascript"></script>
      6 
      7 
      8 
      9 </head>
     10 
     11 <body>
     12 
     13 <p>
     14 Examples of how to use the android.view and android.widget platform APIs.
     15 
     16 For information about view and widget objects, see the topic &quot;Designing
     17 the UI for an Android application&quot; in the SDK documentation.
     18 <ol>
     19     <li>Layouts
     20         <ol>
     21             <li>RelativeLayout
     22                 <ol>
     23                     <li>{@link com.android.samples.view.RelativeLayout1
     24                         Example 1}</li>
     25                     <li>{@link com.android.samples.view.RelativeLayout2
     26                         Example 2}</li>
     27                 </ol>
     28             </li>
     29             <li>LinearLayout
     30                 <ol>
     31                     <li>{@link com.android.samples.view.LinearLayout1
     32                         Example 1}</li>
     33                     <li>{@link com.android.samples.view.LinearLayout2 Example
     34                         2}</li>
     35                     <li>{@link com.android.samples.view.LinearLayout3 Example
     36                         3}</li>
     37                     <li>{@link com.android.samples.view.LinearLayout4 Example
     38                         4}</li>
     39                     <li>{@link com.android.samples.view.LinearLayout5 Example
     40                         5}</li>
     41                     <li>{@link com.android.samples.view.LinearLayout6 Example
     42                         6}</li>
     43                     <li>{@link com.android.samples.view.LinearLayout7 Example
     44                         7}</li>
     45                     <li>{@link com.android.samples.view.LinearLayout8 Example
     46                         8}</li>
     47                 </ol>
     48             </li>
     49             <li>ScrollView
     50                 <ol>
     51                     <li>{@link com.android.samples.view.ScrollView1
     52                         Example 1} </li>
     53                     <li>{@link com.android.samples.view.ScrollView2 Example
     54                         2} </li>
     55                 </ol>
     56             </li>
     57             <li>TableLayout
     58                 <ol>
     59                     <li>{@link com.android.samples.view.TableLayout1
     60                         Example 1}</li>
     61                     <li>{@link com.android.samples.view.TableLayout2 Example
     62                         2}</li>
     63                     <li>{@link com.android.samples.view.TableLayout3 Example
     64                         3}</li>
     65                     <li>{@link com.android.samples.view.TableLayout4 Example
     66                         4}</li>
     67                     <li>{@link com.android.samples.view.TableLayout5 Example
     68                         5}</li>
     69                     <li>{@link com.android.samples.view.TableLayout6 Example
     70                         6}</li>
     71                     <li>{@link com.android.samples.view.TableLayout7 Example
     72                         7}</li>
     73                     <li>{@link com.android.samples.view.TableLayout8 Example
     74                         8}</li>
     75                     <li>{@link com.android.samples.view.TableLayout9 Example
     76                         9}</li>
     77                     <li>{@link com.android.samples.view.TableLayout10 Example
     78                         10}</li>
     79                 </ol>
     80             </li>
     81         </ol>
     82     </li>
     83     <li>Radio Group
     84         <ol>
     85             <li>{@link com.android.samples.view.RadioGroup1 Example 1}</li>
     86         </ol>
     87     </li>
     88     <li>ScrollBars
     89         <ol>
     90             <li>{@link com.android.samples.view.ScrollBar1 Example 1}</li>
     91             <li>{@link com.android.samples.view.ScrollBar2 Example 2}</li>
     92         </ol>
     93     </li>
     94     <li>Visibility
     95         <ol>
     96             <li>{@link com.android.samples.view.Visibility1 Example 1}</li>
     97         </ol>
     98     </li>
     99     <li>Lists
    100         <ol>
    101             <li>{@link com.android.samples.view.List1 Example 1} </li>
    102             <li>{@link com.android.samples.view.List2 Example 2}</li>
    103             <li>{@link com.android.samples.view.List3 Example 3}</li>
    104             <li>{@link com.android.samples.view.List4 Example 4}</li>
    105             <li>{@link com.android.samples.view.List5 Example 5}</li>
    106             <li>{@link com.android.samples.view.List6 Example 6}</li>
    107             <li>{@link com.android.samples.view.List7 Example 7}</li>
    108         </ol>
    109     </li>
    110     <li>Custom
    111         <ol>
    112             <li>{@link com.android.samples.view.CustomView1 Example 1}</li>
    113         </ol>
    114     </li>
    115     <li>Gallery
    116         <ol>
    117             <li>{@link com.android.samples.view.Gallery1 Example 1}</li>
    118             <li>{@link com.android.samples.view.Gallery2 Example 2}</li>
    119         </ol>
    120     </li>
    121     <li>Spinner
    122         <ol>
    123             <li>{@link com.android.samples.view.Spinner1 Example 1}</li>
    124         </ol>
    125     </li>
    126     <li>Grid
    127         <ol>
    128             <li>{@link com.android.samples.view.Grid1 Example 1}</li>
    129         </ol>
    130     </li>
    131     <li>ImageSwitcher
    132         <ol>
    133             <li>{@link com.android.samples.view.ImageSwitcher1 Example
    134                 1}</li>
    135         </ol>
    136     </li>
    137     <li>Animation
    138         <ol>
    139             <li>{@link com.android.samples.view.Animation1 Example 1}</li>
    140             <li>{@link com.android.samples.view.Animation2 Example 1}</li>
    141         </ol>
    142     </li>
    143     <li>Controls
    144         <ol>
    145             <li>{@link com.android.samples.view.Controls1 Example 1}</li>
    146         </ol>
    147     </li>
    148 </ol>
    149 <p></p>
    150 
    151 <h3>LinearLayout Example 1: Stacking Views</h3>
    152 This example shows a simple use of a LinearLayout. The LinearLayout's height is set to
    153 <code>android:layout_height="wrap-content"</code>,
    154 as is the height of each child. Each text view is as tall as it needs
    155 to be, and the height of the LinearLayout itself is the sum of the height of its children.
    156 
    157 <h4>Demo</h4>
    158 Views/Layouts/LinearLayout/Example 1
    159  
    160 <h4>Source files</h4>
    161 <table class="LinkTable">
    162         <tr>
    163             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/LinearLayout1.java</a></td>
    164             <td class="DescrColumn">Loads the linear_layout_1 layout resource</td>
    165         </tr>
    166 		<tr>
    167             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/assets/res/any/layout/linear_layout_1.xml</a></td>
    168             <td class="DescrColumn">Defines the layout</td>
    169         </tr>
    170 		<tr>
    171             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    172             <td class="DescrColumn">Defines the activity</td>
    173         </tr>
    174 </table>
    175 
    176 
    177 
    178 
    179 <h3>LinearLayout Example 2: Stacking Views Again</h3>
    180 In this example, the LinearLayout's height is set
    181 to <code>android:layout_height="fill-parent"</code>, 
    182 so the LinearLayout fills the screen. Each text view is as tall as it needs
    183 to be, so the LinearLayout just stacks them from top to bottom.
    184 
    185 <h4>Demo</h4>
    186 Views/Layouts/LinearLayout/Example 2
    187  
    188 <h4>Source files</h4>
    189 <table class="LinkTable">
    190         <tr>
    191             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/LinearLayout2.java</a></td>
    192             <td class="DescrColumn">Loads the linear_layout_2 layout resource</td>
    193         </tr>
    194 		<tr>
    195             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/assets/res/any/layout/linear_layout_2.xml</a></td>
    196             <td class="DescrColumn">Defines the layout</td>
    197         </tr>
    198 		<tr>
    199             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    200             <td class="DescrColumn">Defines the activity</td>
    201         </tr>
    202 </table>
    203 
    204 
    205 
    206 
    207 <h3>LinearLayout Example 3: Distributing Extra Space</h3>
    208 In this example, the LinearLayout's height is set
    209 to "fill-parent", so the LinearLayout fills the screen. Each text view is as tall as it needs
    210 to be. However, the middle text view has set <code>android:layout_weight="1"</code>. This means that it
    211 will get all of the extra space left over after the LinearLayout has sized all of its children.
    212 
    213 <h4>Demo</h4>
    214 Views/Layouts/LinearLayout/Example 3
    215  
    216 <h4>Source files</h4>
    217 <table class="LinkTable">
    218         <tr>
    219             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/LinearLayout3.java</a></td>
    220             <td class="DescrColumn">Loads the linear_layout_3 layout resource</td>
    221         </tr>
    222 		<tr>
    223             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/assets/res/any/layout/linear_layout_3.xml</a></td>
    224             <td class="DescrColumn">Defines the layout</td>
    225         </tr>
    226 		<tr>
    227             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    228             <td class="DescrColumn">Defines the activity</td>
    229         </tr>
    230 </table>
    231 
    232 
    233 
    234 
    235 <h3>LinearLayout Example 4: Columns</h3>
    236 This time, the orientation of the LinearLayout is set to horizontal.
    237 Each of the four child text views has set <code>android:layout_weight="1"</code>
    238 and <code>android:layout_width="0"</code>.
    239 This means that each child is initially given a width of 0, and then all of the
    240 remaining space (the width of the screen) is divided equally among the four
    241 views.
    242 
    243 <h4>Demo</h4>
    244 Views/Layouts/LinearLayout/Example 4
    245  
    246 <h4>Source files</h4>
    247 <table class="LinkTable">
    248         <tr>
    249             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/LinearLayout4.java</a></td>
    250             <td class="DescrColumn">Loads the linear_layout_4 layout resource</td>
    251         </tr>
    252 		<tr>
    253             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/assets/res/any/layout/linear_layout_4.xml</a></td>
    254             <td class="DescrColumn">Defines the layout</td>
    255         </tr>
    256    		<tr>
    257             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    258             <td class="DescrColumn">Defines the activity</td>
    259         </tr>
    260 </table>
    261 
    262 
    263 
    264 
    265 <h3>LinearLayout Example 5: A Simple Form</h3>
    266 This is a more complete example. It shows:
    267 <ul>
    268 	<li>Using nested LinearLayouts (a horizontal layout inside a vertical layout)
    269 	<li>Using padding on the outer layout
    270 	<li>Using the <code>layout_gravity</code> attribute to position the horizontal layout
    271 		on the right side of the screen
    272 	<li>Using a margin to put some space between buttons
    273 </ul>
    274 
    275 <h4>Demo</h4>
    276 Views/Layouts/LinearLayout/Example 5
    277  
    278 <h4>Source files</h4>
    279 <table class="LinkTable">
    280         <tr>
    281             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/LinearLayout5.java</a></td>
    282             <td class="DescrColumn">Loads the linear_layout_5 layout resource</td>
    283         </tr>
    284 		<tr>
    285             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/assets/res/any/layout/linear_layout_5.xml</a></td>
    286             <td class="DescrColumn">Defines the layout</td>
    287         </tr>
    288    		<tr>
    289             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    290             <td class="DescrColumn">Defines the activity</td>
    291         </tr>
    292 </table>
    293 
    294 <h3>RelativeLayout Example 1: Stretching</h3>
    295 There are three views in this example. The first view (view1) is pinned to the top of the screen through the use of this
    296 attribute: <code>android:layout_alignParentTop="true"</code>. 
    297 The second view (view2) is pinned to the bottom of the screen: <code>android:layout_alignParentBottom="true"</code>.
    298 This demonstrates how views can be positioned relative to the RelativeLayout itself.
    299 
    300 <p>Views can also be positioned relative to each other as well. In this example, view3 is below view1 and above
    301 view2: <code>android:layout_above="view2" android:layout_below="view1"</code>. This has the effect of making 
    302 view3 stretch between view1 and view2.</p> 
    303 
    304 <p>Note that since view3 depends on the positions of both view1 and view2, it is defined after them in the layout
    305 file.</p> 
    306 
    307 <h4>Demo</h4>
    308 Views/Layouts/RelativeLayout/Example 1
    309  
    310 <h4>Source files</h4>
    311 <table class="LinkTable">
    312         <tr>
    313             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/RelativeLayout1.java</a></td>
    314             <td class="DescrColumn">Loads the relative_layout_1 layout resource</td>
    315         </tr>
    316 		<tr>
    317             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/assets/res/any/layout/relative_layout_1.xml</a></td>
    318             <td class="DescrColumn">Defines the layout</td>
    319         </tr>
    320 		<tr>
    321             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    322             <td class="DescrColumn">Defines the activity</td>
    323         </tr>
    324 </table>
    325 
    326 
    327 <h3>RelativeLayout Example 2: A Simple Form Revisited</h3>
    328 The form created in LinearLayout Example 5 is recreated using a RelativeLayout. This example demonstrates:
    329 
    330 <ul>
    331 	<li>Using padding on the outer layout
    332 	<li>Positioning views realtive to one another using the <code>android:layout_below</code> and 
    333 	<code>android:layout_below</code> and <code>android:layout_toLeft<code> attributes.
    334 	<li>Aligning the top edges of the buttons with the <code>android:layout_alignTop<code> attribute
    335 	<li>Right-aligning the OK button with <code>android:layout_alignParentRight</code>
    336 	<li>Using a margin to put some space between buttons
    337 </ul>
    338 
    339 <h4>Demo</h4>
    340 Views/Layouts/RelativeLayout/Example 2
    341  
    342 <h4>Source files</h4>
    343 <table class="LinkTable">
    344         <tr>
    345             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/RelativeLayout2.java</a></td>
    346             <td class="DescrColumn">Loads the relative_layout_2 layout resource</td>
    347         </tr>
    348 		<tr>
    349             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/assets/res/any/layout/relative_layout_2.xml</a></td>
    350             <td class="DescrColumn">Defines the layout</td>
    351         </tr>
    352 		<tr>
    353             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    354             <td class="DescrColumn">Defines the activity</td>
    355         </tr>
    356 </table>
    357 
    358 <h3>Scrolling Example 1</h3>
    359 All of the layout classes discussed above do not scroll. 
    360 They simply arrange their children within whatever space is made available to them.
    361 
    362 <p>The ScrollView is used to implement vertical scrolling. It does not display any
    363 content of its own. Instead, it assumes it has one child and pans up and down to keep
    364 the interesting area of its child in view.</p>
    365 
    366 <p>In this example, a ScrollView is used to wrap a LinearLayout. The LinearLayout
    367 in turn contains a stack of TextViews and Buttons. The ScrollView is as wide as 
    368 the screen (<code>android:layout_width="fill-parent"</code>) and tall enough to 
    369 wrap the LinearLayout (<code>android:layout_height="wrap-content"</code>). The 
    370 LinearLayout uses the same parameters, so it is also as wide as the screen and is as
    371 tall as the sum of the heigts of all of its children.</p>
    372 
    373 <h4>Demo</h4>
    374 Views/Layouts/ScrollView/Example 1
    375  
    376 <h4>Source files</h4>
    377 <table class="LinkTable">
    378         <tr>
    379             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/ScrollView1.java</a></td>
    380             <td class="DescrColumn">Loads the scroll_view_1 layout resource</td>
    381         </tr>
    382 		<tr>
    383             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/assets/res/any/layout/scroll_view_1.xml</a></td>
    384             <td class="DescrColumn">Defines the layout</td>
    385         </tr>
    386  		<tr>
    387             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    388             <td class="DescrColumn">Defines the activity</td>
    389         </tr>       
    390 </table>
    391 <h2><a name="Lists">Lists</a></h2>
    392 <h3>ListView Example 1: A "Hello World" List</h3>
    393 
    394 ListViews are used to display vertically scrolling list of information. Unlike the ScrollView, which pans up and 
    395 down through a set of views that have already been built, the ListView is "virtualized", meaning that views are 
    396 created only as necessary in order to display what is actually on the screen. ListViews can thus be used to 
    397 efficiently display very large sets of data. (In this example, the list displays over 600 kinds of cheese.) 
    398 
    399 <p>ListViews are highly customizable: you can change where the underlying data comes from, the internal
    400 representation of the data, and the Views that are used to display the data on the screen. All of this is 
    401 done with a ListAdapter class. The Android platform includes some ListAdapters that are ready to use, or 
    402 you can make your own to display custom information. (See ListView Example 4 and ListView Example 5.)</p>
    403 
    404 <p>This example uses an existing ListAdapter called ArrayListAdapter. This adapter uses generics to map
    405 an array of objects to TextViews. In this case we are using an array of Strings.</p>
    406 
    407 <p>Note that this example does not have a layout file. This is because the List1 class derives from 
    408 ListScreen, which will provide a default layout if your activity does not provide an override.</p>
    409 
    410 <h4>Demo</h4>
    411 Views/Lists/Example 1
    412  
    413 <h4>Source files</h4>
    414 <table class="LinkTable">
    415         <tr>
    416             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/List1.java</a></td>
    417             <td class="DescrColumn">Contains code for the List1 class</td>
    418         </tr>
    419 		<tr>
    420             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    421             <td class="DescrColumn">Defines the activity</td>
    422         </tr>
    423 </table>
    424 
    425 <h3>ListView Example 2: Displaying Data from a Cursor </h3>
    426 
    427 It is very common to display data from a database in a ListView. The easiest way to do this is to use a 
    428 SimpleCursorListAdapter. This is a class that will get data from a Cursor and display the data in 
    429 each row in Views defined in an XML template.
    430 
    431 <p>In this example, the SimpleCursorListAdapter is provided with a cursor that contains a list of all 
    432 people. Each row will be displayed using the Views defined in this XL file: 
    433 <a href="" onClick="findCode(this)">//device/apps/common/assets/res/any/layout/simple_list_item_1.xml</a>.
    434 </p>
    435 
    436 <p>When creating a SimpleCursorListAdapter, you also provide a mapping from column names in the 
    437 Cursor to view ids in the template file. In this case we are mapping the People.NAME column to the
    438 "text1" TextView.
    439 </p>
    440 
    441 <h4>Demo</h4>
    442 Views/Lists/Example 2
    443  
    444 <h4>Source files</h4>
    445 <table class="LinkTable">
    446         <tr>
    447             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/List2.java</a></td>
    448             <td class="DescrColumn">Contains code for the List2 class</td>
    449         </tr>
    450 		<tr>
    451             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/apps/common/assets/res/any/layout/simple_list_item_1.xml</a></td>
    452             <td class="DescrColumn">Defines the XML template used for each row. 
    453             (Note that this file is provided as part of the Android platform.)</td>
    454         </tr>
    455 		<tr>
    456             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    457             <td class="DescrColumn">Defines the activity</td>
    458         </tr>
    459 </table>
    460 
    461 
    462 <h3>ListView Example 3: Displaying Data from a Cursor, Fancier Version </h3>
    463 
    464 This example extends the idea presented in Example 2. Instead of just presenting a list of names, though,
    465 it shows two lines of information for the selected item (name and phone number). It shows just the name for unselected items. 
    466 
    467 <p>
    468 This example still uses a SimpleCursorListAdapter, but changes the following:</p>
    469 
    470 <ul>
    471 	<li>The Cursor now contains all phone numbers
    472 	<li>It uses a different template for each row: <a href="" onClick="findCode(this)">//device/apps/common/assets/res/any/layout/simple_list_item_2.xml</a>
    473 	<li>Since simple_list_item_2.xml contains two views, were mapping two columns 
    474 	<code>{ Phones.NAME, Phones.NUMBER }</code> to the two views 
    475 	<code>{ "text1", "text2"}</code>
    476 	<li>The simple_list_item_2.xml uses a TwoLineListItem view, which is a subclass of LinearLayout that knows to only show
    477 	the second item when it is selected.
    478 </ul>
    479 
    480 <h4>Demo</h4>
    481 Views/Lists/Example 3
    482  
    483 <h4>Source files</h4>
    484 <table class="LinkTable">
    485         <tr>
    486             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/List3.java</a></td>
    487             <td class="DescrColumn">Contains code for the List3 class</td>
    488         </tr>
    489 		<tr>
    490             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/apps/common/assets/res/any/layout/simple_list_item_2.xml</a></td>
    491             <td class="DescrColumn">Defines the XML template used for each row. 
    492             (Note that this file is provided as part of the Android platform.)</td>
    493         </tr>
    494 		<tr>
    495             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    496             <td class="DescrColumn">Defines the activity</td>
    497         </tr>
    498 </table>
    499 
    500 
    501 
    502 <h3>ListView Example 4: Writing a Custom ListAdapter </h3>
    503 
    504 The previous examples all used standard ListAdapters. It is also possible to write your own ListAdapters 
    505 to access data from custom sources.
    506 
    507 <p>
    508 This example introduces a SongListAdapter, which gets its data from an array of titles and an array of lyrics. 
    509 The SongListAdapter then produces a SongView which is capable of displaying this data.
    510 </p>  
    511 
    512 <p>
    513 This example also shows how the ListView handles scrolling large items.
    514 
    515 <h4>Demo</h4>
    516 Views/Lists/Example 4
    517  
    518 <h4>Source files</h4>
    519 <table class="LinkTable">
    520         <tr>
    521             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/List4.java</a></td>
    522             <td class="DescrColumn">Contains code for the List4 class, along with a custom ListAdapter and custom View to display the data.</td>
    523         </tr>
    524 		<tr>
    525             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    526             <td class="DescrColumn">Defines the activity</td>
    527         </tr>
    528 </table>
    529 
    530 
    531 
    532 <h3>ListView Example 5: List Separators </h3>
    533 
    534 ListView supports the concept of non-selectable "separators" between items. The ListView delegated to its ListAdapter the
    535 task of deciding whether a given position in the list is a separator or selectable data.
    536 
    537 <p><i>This example needs some cleanup.</i></p>
    538 
    539 <h4>Demo</h4>
    540 Views/Lists/Example 5
    541  
    542 <h4>Source files</h4>
    543 <table class="LinkTable">
    544         <tr>
    545             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/List5.java</a></td>
    546             <td class="DescrColumn">Contains code for the List5 class, along with a custom ListAdapter.</td>
    547         </tr>
    548 		<tr>
    549             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    550             <td class="DescrColumn">Defines the activity</td>
    551         </tr>
    552 </table>
    553 
    554 <h2><a name="Working">Working with Views</a></h2>
    555 
    556 <h3>Custom View Example 1: LabelView</h3>
    557 
    558 
    559 
    560 <p>
    561 Note: This example does not support multi-line or right-to-left text. It is sample code only
    562 and should not be used in place of the TextView.
    563 </p>
    564 
    565 
    566 <h4>Demo</h4>
    567 Views/Custom/Example 1
    568  
    569 <h4>Source files</h4>
    570 <table class="LinkTable">
    571         <tr>
    572             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/CustomView1.java</a></td>
    573             <td class="DescrColumn">Loads the custom_view_3 layout resource</td>
    574         </tr>
    575 		<tr>
    576             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/src/com/android/sdk/view/LabelView.java</a></td>
    577             <td class="DescrColumn">Implementation of the custom view</td>
    578         </tr>
    579 		<tr>
    580             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/assets/res/any/layout/custom_view_1.xml</a></td>
    581             <td class="DescrColumn">Defines a layout that uses LabelViews</td>
    582         </tr>
    583 		<tr>
    584             <td class="LinkColumn"><a href="" onClick="findCode(this)">//device/samples/SampleCode/AndroidManifest.xml</a></td>
    585             <td class="DescrColumn">Defines the activity</td>
    586         </tr>
    587 </table>
    588 </body>
    589 </html>
    590