The android getView method is not executed because the layout file does not display the list.

Source: Internet
Author: User

The android getView method is not executed because the layout file does not display the list.

One reason is that the layout file does not display the position in the list.

For example, the following Layout

Android: id = "@ + id/list_find"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: cacheColorHint = "@ android: color/transparent"
Android: divider = "@ drawable/base_horizontal_line"
Android: dividerHeight = "1dp"
Android: fadingEdgeLength = "0dp"
Android: fastScrollEnabled = "true"
Android: paddingBottom = "10dp"/>

Android: id = "@ + id/list_article"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: cacheColorHint = "@ android: color/transparent"
Android: divider = "@ drawable/base_horizontal_line"
Android: dividerHeight = "1dp"
Android: fadingEdgeLength = "0dp"
Android: fastScrollEnabled = "true"
Android: paddingBottom = "10dp"/>

The first name is the View height of list_find, Which is match_parent. The space has been fully occupied. As a result, the first View named list_article has no space to display. In this way, the View does not execute the getView method, data cannot be displayed.


In addition, if the getCount result of view is 0, the getView method is not executed.

Related Article

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.