Android ListView set adapter for the first time GetView call multiple times

Source: Internet
Author: User

Before encountering this strange phenomenon, record:

When using the ListView and setting adapter, it will callback multiple getview, such as I have 4 items, supposedly getview should be called once (4 log), the result callback has 4 times (4*4 log).

Reason:

The layout_height of the ListView is adaptive: wrap_content, in this case, the ListView has no way of determining how many item's view to populate itself with, forcing the ListView to measure its child elements multiple times.

Solve:

[HTML] view Plaincopy

  1. android:layout_height="Match_parent"

http://blog.csdn.net/wyzxk888/article/details/15335857

Android ListView set adapter for the first time GetView call multiple times

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.