Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the difference between getWidth/Height() and getMeasuredWidth/Height() in Android SDK?
    primarykey
    data
    text
    <p>The <a href="http://developer.android.com/reference/android/view/View.html#SizePaddingMargins" rel="noreferrer">Android Documentation says</a> that there is two sizes for a view, the <em>measured dimensions</em> and the <em>drawing dimensions</em>. The measured dimension is the one computed in the <em>measure pass</em> (the <a href="http://developer.android.com/reference/android/view/View.html#onMeasure%28int,%20int%29" rel="noreferrer">onMeasure</a> method), while the <em>drawing dimensions</em> are the actual size on screen. Particularly, the documentation says that:</p> <blockquote> <p>These values may, but do not have to, be different from the measured width and height.</p> </blockquote> <p>So, my question is: what could make the drawing dimension be different of the measured dimension? If the <a href="http://developer.android.com/reference/android/view/View.html#onMeasure%28int,%20int%29" rel="noreferrer">onMeasure(int,int)</a> method respects the layout requirements (given as the parameters <em>widthMeasureSpec</em> and <em>heightMeasureSpec</em>, how could the SDK decides that the view should have a different drawing size?</p> <p>Additionally, how/where in the <a href="https://github.com/android" rel="noreferrer">Android Source Code</a> the measured width/height is used to compute the drawing width/height? I tryed to look into the <a href="https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/View.java" rel="noreferrer">View source code</a>, but I can't figure out how the measuredWidth/Height is used to compute the final width/height. Maybe it has something to do with the padding, but I'm not sure.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload