title: Determine size of a view in RecyclerView
body: <p>I'm dynamically <em>rendering</em> (as opposed to downloading) thumbnails for items displayed in a <code>RecyclerView</code>. The rendering should render those thumbnails at the size of the item (so there's no upscaling or downscaling).</p>
  
  <p>I've tried calling measure() on the imageView in my <code>RecyclerView</code>.Adapter subclass's <code>onBindViewHolder</code> and <code>onViewAttachedToWindow</code> and in both cases, the measured size ( and actual size ) are reported as 0.</p>
  
  <p>So, the trouble is simply, I can't figure out how to know what size to render my thumbnails at.</p>
  
  <p>My best guess right now is to attach a listener to <code>getViewTreeObserver().addOnGlobalLayoutListener()</code> and to render my thumbnails in that callback, but that seems awkward. Is that really the only way?</p>
  
  <p>I can't find any method in <code>GridLayoutManager</code> or <code>RecyclerView</code> to simply ask, "how big will this child view be?"</p>
  
  <p>Thanks,</p>