4.4.5. ListView Item’s Layout: list_item.xml
When populating a ListView
with data, you must specify the format that’s applied to each list item. Each list item in this app displays the String
tag name for one saved search. To specify each list item’s formatting, you’ll create a new layout that contains only a TextView
with the appropriate formatting. Perform the following steps:
1. In the Package Explorer window, expand the project’s res
folder, then right click the layout
folder and select New > Other... to display the New dialog.
2. In the Android node, select Android XML Layout File and click Next > to display the dialog in Fig. 4.16, then configure the file as shown. The new layout’s file name is list_item.xml
and the root element in the ...
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.