title: How do I trigger the redraw of a parent View when any of it's children are redrawn?
body: <h1>Background</h1>
  
  <p>I have written a custom Android View based on a <code>LinearLayout</code> which I have called <code>ReflectingLayout</code>. The idea is fairly simple, to render a reflection effect below any child Views declared within the <code>ReflectingLayout</code>. e.g...</p>
  
  <p><img src="https://t3.gstatic.com/images?q=tbn:ANd9GcQpf0IpB89pF1lnclD46KFtxz8KmV4Lp-fEaDDYnPc4FOK1fb-jWA" alt="Something like this"></p>
  
  <p>I am achieving this by overriding <code>dispatchDraw()</code> in <code>ReflectingLayout</code> as follows:</p>
  
  <pre><code>@Override
  protected void dispatchDraw(Canvas canvas) {
  
    Bitmap bitmap = Bitmap.createBitmap(...); 
    Canvas tempCanvas = new Canvas(bitmap);
  
    // Draw child views to bitmap using tempCanvas
    super.dispatchDraw(tempCanvas);
  
    ...
    // some tranformations performed on bitmap
    ...
  
    // draw transformed image on to main canvas
    canvas.drawBitmap(bitmap, 0, 0, null);
  }
  </code></pre>
  
  <h1>The Problem</h1>
  
  <p>If my <code>ReflectingLayout</code> contains, say, a <code>TextView</code> and I change the text content of that <code>TextView</code> the reflection effect is not updating.</p>
  
  <p>I believe this is because Android will only redraw the <code>TextView</code> itself rather than all the parent views as well, meaning my overridden <code>dispatchDraw()</code> method does not get called.</p>
  
  <p><strong>Is there any simple way to trigger the redrawing of a parent view in response to changes in any of it's child views?</strong></p>
  
  <p>In particular, how can I make my <code>ReflectingLayout</code> be redrawn when child views are redrawn?</p>
  
  <h1>Things I've already considered</h1>
  
  <ul>
  <li><p>I've noticed that a new <a href="http://developer.android.com/reference/android/view/View.OnLayoutChangeListener.html" rel="nofollow noreferrer"><code>View.OnLayoutChangeListener</code></a> was added in API Level 11. Presumably this could be used to register a callback to the parent view and trigger a redraw(?). In any case, I need a solution which will work on API Level 7 upwards. </p></li>
  <li><p>I could simply extend <code>TextView</code> and any other View class I want to declare inside <code>ReflectingLayout</code> to invalidate their parent as they are redrawn, but this is a clunky solution. </p></li>
  </ul>
  
  <p>Any help greatly received (including if you think the overall approach is wrong). </p>
  
  <p>Thanks.</p>