The ListView Adapter GetView in Android has been repeatedly called the problem resolution method

Source: Internet
Author: User

This is done several times because each view is displayed, it measures the height of the view, executes the measure method, and causes the GetView to execute multiple times.

The workaround is to add the ListView Layout_width is set to Fill_parent,
 <ListViewAndroid:id= "@+id/lv_messages"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"Android:layout_alignparentleft= "true"Android:layout_below= "@+id/linearlayout1"Android:cachecolorhint= "#0000"Android:divider= "#0000"Android:dividerheight= "2DP"Android:listselector= "#0000" > </ListView>

The width and height are set to Fill_parent, if the ListView has a parent layout, the width and height of the parent layout are set to Fill_parent, which successfully resolves the problem that the custom adapter GetView performed multiple times.

The ListView Adapter GetView in Android has been called the problem resolution 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.