Android's ListView

Source: Internet
Author: User

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.