title: Custom view in xml layout
body: <p>I've created my own view by creating a subclass of the SurfaceView class.</p>
  
  <p>However I can't figure out how to add it from the xml layout file. My current main.xml looks like this:</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;View
      class="com.chainparticles.ChainView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
      /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>What have I missed?</p>
  
  <p>Edit</p>
  
  <p>More info</p>
  
  <p>My view looks like this</p>
  
  <pre><code>package com.chainparticles;
  public class ChainView extends SurfaceView implements SurfaceHolder.Callback {
      public ChainView(Context context) {
          super(context);
          getHolder().addCallback(this);
      }
  // Other stuff
  }
  </code></pre>
  
  <p>And it works fine like this:</p>
  
  <pre><code>ChainView cview = new ChainView(this);
  setContentView(cview);
  </code></pre>
  
  <p>But nothing happens when trying to use it from the xml.</p>