Customizing List Items
So far, each of your list items only displays the title of a Crime – the result of Crime.toString().
When you want to display more than just a string, you can create custom list items. Implementing custom list items requires two things:
creating a new layout in XML that defines the view for the list item
creating a subclass of ArrayAdapter<T> that knows how to create, populate, and return the view defined in the new layout
Creating the list item layout
For CriminalIntent, a list item’s layout should include the crime’s title, its date, and whether the case has been solved (Figure 9.11). This layout calls for two TextViews and a CheckBox.
Figure 9.11 A handful of custom list items
You create a new layout for a list item ...
Get Android Programming: The Big Nerd Ranch Guide 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.