Project Source Download
Https://github.com/Wang-Jun-Chao/AndroidProjects
Listview
That is used to display an entry in one line.
MVC structure
M:model the model layer, the data to display ———— people collection
V:view view layer, the user sees the interface ———— ListView
C:control control layer, operation data How to display ———— adapter object
Each entry is a View object
Baseadapter
Two methods that must be implemented
First one
() {
people.size();
}
A second
@Override
View ( position, View convertView, ViewGroup parent) {
System..println( + position);
TextView tv = TextView(MainActivity.);
Person p = people.(position);
tv.setText(p.toString());
tv;
}
How many entries can be displayed on the screen, how many times the GetView method will be invoked, and when the screen slides down, GetView will continue to be called, creating more View objects to display to the screen
The cache of entries
When the entry is drawn to the screen, the system caches the entry to memory, and when the entry is again on the screen, the system GetView the cached entry as a Convertview parameter when it is called back, but the incoming entry is not necessarily the entry that was previously cached, That is, it is possible for the system to pass in a cache of any entry when the GetView method is invoked to get the first entry
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/