Inside the activity, a ListView is set up to show three sections: fruits, vegetables, and meats. The SimpleSectionsAdapter takes two resource IDs of the layouts that the adapter should inflate for headers and content. The header layout in this example is a custom layout centering a single TextView, while the content layout is a standard layout from the framework (android.R.id.simple_list_item_1). Since the adapter is abstract, we are required to provide a definition of onSectionClick(), which in this case just displays the name of the selected item in a Toast.
1-10. Creating Compound Controls
Problem
You need to create a custom widget that is a collection of existing elements.
Solution
(API Level 1)
Create a custom widget by extending a common ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access