title: android: custom view layout wrapping
body: <p>I want to have two custom views like this:</p>
  
  <pre><code>class LoadingView extends RelativeLayout{
      //this view has a progressBar and can show and hide it.
  
      void setIsLoading(){
          // shows/hides progress bar
      }
  
  
      // some code ...
  }
  
  class OtherView extends LoadingView{
      //some code ...
  }
  </code></pre>
  
  <p>LoadingView has a layout like this:</p>
  
  <pre><code>&lt;RelativeLayout&gt;
      &lt;FrameLayout
          id="@+id/content"&gt;
          &lt;!--this is where content goes--&gt;
      &lt;/FrameLayout&gt;
  
      &lt;ProgressBar
          id="@+id/pb"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>so that any custom view that inherits from it will be injected into <code>FrameLayout</code></p>
  
  <p>so if <code>OtherView</code> has it's own layout , it will be nested inside <code>FrameLayout</code> automatically and you will be able to call <code>myOtherView.setIsLoading(true/false)</code></p>
  
  <p>How would you suggest doing this ?</p>