 <p>You say that you need to access <code>getHeight()</code> to calculate <code>desiredWidth</code> inside the <code>onMeasure()</code> method and also that <code>getHeight()</code> is not ready.</p> <p>Yes, <code>getHeight()</code> or <code>getWidth()</code> can't be accessed from <code>onMeasure()</code> because these <code>height</code> and <code>width</code> are set in <code>onMeasure()</code> method. In your <code>onMeause()</code> method, you need to call <code>setMeasuredDimension()</code>. You have done that in your code.</p> <pre><code> setMeasuredDimension(width, height); </code></pre> <p>This <code>width</code> is what you will get when you call <code>getWidth()</code> and this <code>height</code> is what you will get when you call <code>getHeight()</code>. </p> <p>So if you want to access <code>getHeight()</code>, then use <code>height</code> instead.</p>