Thursday, January 24, 2013

How to Implement a List in Android XML



1. Double-click the 'Eclipse.exe' file to open the Eclipse software. If you do not have a shortcut set up, click the Windows 'Start' button and type 'eclipse.exe' to find the software's executable.

2. Double-click the 'res' directory in the left panel. This directory contains each menu and layout for your Android app. Double-click the XML file you want to use to create the list of items.

3. Add your list items. The following code is an example of a list of two items:

android:icon='@drawable/help'

android:title='@string/My Item1 Text' />

android:icon='@drawable/ic_help'

android:title='@string/My Item1 Text' />

The 'ID' tag is required to interface between your users and the Android device. The 'Title' tag displays the icon's text. This tag text is what your users see when the Android screen is displayed. You can continue to add items to the list, but each item must have its own unique 'ID' in the list.

No comments:

Post a Comment