Android learning-day 6 and day 6
Learning Content: ListFragment component
==== ListFragment ====
ListFragment is a subclass of Fragment. It is used to abstract the List View (ListView). However, it uses a controller called adapter to interact with the MODEL layer!
The functions of the adapter are as follows:
1. create necessary view components (such as TextView)
2. Get data from the MODEL layer (main functions)
3. Provide a View to the ListView for display.
Generally, ArrayAdapter is used to obtain a large number of adapters. By default, ArrayAdapter <T>. getView (...) depends on the ToString () method of the specific data model class.
Text Content. If the default implementation method is not met, you can customize the content of the list project:
1. Create a new list view layout File
2. Create a subclass, inherit from ArrayAdapter, and implement necessary methods (such as the getView method)
In addition, the following method:
Public void onListItemClick (ListView l, View v, int position, long id)
Used to respond to user click operations
Fragment arguments
Similar to the information interaction mode between activities, fragment also has its own information interaction mode, which is similar to activity!