Android Simple Development Tutorial 11: Customizing Adapter Display list

Source: Internet
Author: User

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" >
<string -array name= "Activity_info" >
<item>pattern ,gradients</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>
</string- array>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.