The difference between getwidth and getmeasuredwidth in the view window of Android

Source: Internet
Author: User

Today in the study itself defines the effect of the drop-down refresh of the ListView. Want to transplant to the project requirements, and then look at their own definition of the source code found a problem is getwidth and getmeasuredwidth two methods what difference, ask the almighty Baidu, after investigation found that the difference between the two methods is, GetWidth gets the visible width of the current view, but pull down to refresh the demand, the view of the head hint is hidden so that the getwidth can not get the width of the view. So take the getmeasuredwidth way to get it.

The Getmeasuredwidth method represents the ability to get the visual width of the view + the width of the hidden place. In this demand our headview is always hidden, so there is only one way to get to the desired width through this getmeasuredwidth method, and a picture represents the principle I'm talking about, which is more intuitive.


Special Thanks post address: http://blog.sina.com.cn/s/blog_6e519585010152s5.html

The difference between getwidth and getmeasuredwidth in the view window of Android

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.