The difference between view forms GetWidth and Getmeasuredwidth in Android

Source: Internet
Author: User

Today in the study of custom ListView drop-down refresh effect, want to migrate to the project requirements, and then see the custom source code found a problem is getwidth and getmeasuredwidth two methods have what difference, ask the almighty Baidu, after investigation found that the difference between the two methods is , GetWidth obtained is the current view of the visible width, but pull down to refresh the demand, the head hint of the view is hidden so that the getwidth can not get the width of the view, so take the getmeasuredwidth way to get. The Getmeasuredwidth method represents the width of the visible width of the view + the hidden place. In this demand, our headview is always hidden, so only through this getmeasuredwidth method can get to the desired width, a picture represents the principle I said, so more intuitive.


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

The difference between view forms GetWidth and Getmeasuredwidth in 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.