In the introduction of data binding, we used the system with the Simpleadapter. Android allows custom adapter, and can theoretically use arbitrary view (Layout) to display data. The following figure changes the Androidgraphics2dtutorial and uses a custom adapter to display a list of sample activity.
In the example, we renamed the original androidgraphics2dtutorial to Androidgraphics2dtutorial1 and recreated a class androidgraphics2dtutorial to display the sample list. You intend to use three view to display one of the items in the list, one icon (some random icons are used in the example), one text box to display the sample activity name, and the other text box to display the specific information for the sample. Create a activitylist.xml in the Res/layout directory. The contents are as follows:
This time we do not read the activity list from the Androidmanifest.xml, but instead use the string array resource. Add the following array resources to the Res/value/string.xml:
<string-array name= "Activity_name" >
<item>Bezier</item>
<item>Brush</item>
<item>Colors</item>
<item>Font</item>
<item>Image</item>
<item>Path</item>
<item>Pen</item>
<item>Shape</item>
<item>Transform</item>
</string-array>
<string
-array name= "Activity_info" >
<item>Bezier</item>
<item>pattern
,gradients</item>
<item>Colors</item>
<item>fontdemo,
fonttypes</item>
<item>drawmap, Jumbleimage, seethroughimage</item>
<item>polys, paths</item>
<item>lines, dashes, linecap,linejoin</item>
<item>oval, Pear,shape2ddemo</item>
<item>Transform</item>
</string-
array>