Android ListView Note the place

Source: Internet
Author: User

In many cases the ListView list data does not need to be refreshed all the time, just refresh the one with data changes, you can use Getchildat (index) to get a specified position view, and refresh the view.

1.getchaildAt is actually a range of values, which will return NULL if it goes out of range

The following ranges are given:>= listview.getfirstvisibleposition () && <= listview.getlastvisibleposition ();

You need to use getfirstvisibleposition () to get the first visible position, then use the current position-it, and then use the Getchildat to take a value! That is Getchildat (Position-listview. Getfirstvisibleposition ()) a value exists

2.getChildCount the value obtained from GetCount will be different

Listview.getcount () (actually Adapterview.getcount ()) returns the value returned by its adapter.getcount ().

That is, the total number of items contained in the Item.

Listview.getchildcount () (Viewgroup.getchildcount) returns the "number of child View contained" on the display plane.

When the item in the ListView is less than scrolling to display it all, the two are equivalent; Getchildcount () < GetCount () if the item number requires scrolling to browse all

where Getchildcount () returns the Item count that is currently visible


Android ListView Note the place

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.