title: How to use custom Android ViewGroup in XML?
body: <p>I have a class that extends FrameLayout called NoteView.
  It is a top level public class.</p>
  
  <p>It works just fine when I'm creating the UI from java code, but I can't figure out how to use it in XML.  I tried inserting the fully qualified class name just like I would for a custom view, but I get and exception <code>ClassCastException: android.view.View cannot be cast to android.view.ViewGroup</code> when activity tries to inflate the XML.</p>
  
  <p>I have only been able to find tutorials on Custom Views, not custom viewgroups.  What do I need to do to use a NoteView just like I would a FrameLayout in an XML Layout?</p>
  
  <p>For example: This works</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
   &lt;test.cjb.sandbox.NoteView
   android:id="@+id/noteview"
   android:layout_width="fill_parent"
   android:layout_height="100dp"
   android:background="#FF0000"
   android:layout_gravity="right"&gt;
   &lt;/test.cjb.sandbox.NoteView&gt;
    &lt;Button
      android:id="@+id/button"
      android:layout_width="100dp"
      android:layout_height="fill_parent"
      android:text="Sibling Button"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>But this throws the above exception:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
   &lt;test.cjb.sandbox.NoteView
   android:id="@+id/noteview"
   android:layout_width="fill_parent"
   android:layout_height="100dp"
   android:background="#FF0000"
   android:layout_gravity="right"&gt;
      &lt;Button
      android:id="@+id/button"
      android:layout_width="100dp"
      android:layout_height="fill_parent"
      android:text="Child Button"/&gt;
   &lt;/test.cjb.sandbox.NoteView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>