The difference between Android getmeasuredheight () and GetHeight ()

Source: Internet
Author: User

Public Final intGetmeasuredheight()Added in API Level 1

Like getMeasuredHeightAndState() , but only returns the raw width component (which is the result of masked by MEASURED_SIZE_MASK ).

Returns
    • The raw measured height of this view.
Public Final intgetheight()Added in API Level 1

Return the height of your view.

Returns
    • The height of your view, in pixels.

Getmeasuredheight () returns the original measurement height, regardless of the screen, and GetHeight () returns the height displayed on the screen. In fact, when the screen can wrap the content, their values are equal, only when the view beyond the screen to see their differences. When the screen is exceeded, getmeasuredheight () equals getheight () plus the height that is not displayed outside the screen.

Cases:

 <  relativelayout  xmlns:android  = "http:// Schemas.android.com/apk/res/android "  Android:layout_width " Span style= "Color:rgb (0, 0, 255); >= "Match_parent"   Android:layout_height  = "240dip"   android:cliptopadding  = "false"   android:scrolly  = "50dip"  </ relativelayout  

Here it is set to a height of 240dip, exceeding the screen 50dip.

Getmeasuredheight () Gets the size of 240dip. (converted to pixel values)

GetHeight () Gets the size of the 240dip-50dip. (converted to pixel values)

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.