title: Xml layout to Java code generator
body: <p>Does anybody know a tool to create java code from a xml layout file.</p>
  
  <p>It would be useful, to create quickly a custom view (I do not want to create a separate library project) that I would like to include in an activities layout.</p>
  
  <p>So lets say my custom view would be a Relative Layout with some child views.</p>
  
  <p>It would be great if the tool could generate from a layout file  like this:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;!-- some child Views --&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>a java class like this:</p>
  
  <pre><code>class CustomView extends RelativeLayout{
  
      /*
       * Generate all the Layout Params and child Views for me
       */
  }
  </code></pre>
  
  <p>And at the end I could use this generated class in a normal XML </p>
  
  <pre><code>&lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      /&gt;
  
      &lt;TextView 
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      text="Hello World" /&gt;
  
  
      &lt;com.example.CustomView
      android:layout_width="match_parent"
      android:layout_height="100dp" 
      /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Does such a tool exists?</p>