[Android bug] the header and footer in listview cannot hide (gone) Problems

Source: Internet
Author: User

Headers and footer views in listview should be met. For example, loading is automatically started when scrolling to the bottom. For some application markets, viewflipper will be added in the header for application recommendation (the scrolling type seems to be available in many markets ).

Generally, you can perform the following operations when adding an object:

Listview = xxxx; listview. addhearderview (item_head); listview. setadapter (adapter );

After the page is displayed normally, if the user refreshes and finds no application to be recommended, the listview header needs to be hidden. The first thought is:

Item_head.setvisibility (view. Gone );

Yes, the content does disappear, but the location is still occupied. A blank area is displayed on the page!

Some people say that setting the header neutron view to invisible; some say that setting the header neutron view height to 0; but I tested it here, it didn't work ..

My solutions:

Item_head.setpadding (0,-1 * headcontentheight, 0, 0); item_head.setvisibility (view. Gone );

Finally, I want to say that this problem really hurts! Record it here and make a memo!

Refer:

Http://stackoverflow.com/questions/4317778/hide-footer-view-in-listview

Http://blog.sina.com.cn/s/blog_70b9730f01014sgm.html

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.