title: Android I cannot inflate custom view
body: <p>I create a custom view for actionbar.When i use <code>&lt;inclued layout=@layout/XXXXX /&gt;</code>is ok.However ,when i use LayoutInflater to inflate the view ,it cannot inflate it .Here is my code</p>
  
  <pre><code>public class TitleLayout extends LinearLayout {
  //    private Button btn_back;
  //    private Button btn_edit;
      public TitleLayout(Context context, AttributeSet attrs) {
          super(context, attrs);
          LayoutInflater.from(context).inflate(R.layout.view_title,this);
      }
  }
  </code></pre>
  
  <p>TitleLayout is my custom view</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/btn_back"
          android:layout_gravity="center"
          android:text="Back"/&gt;
      &lt;TextView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:id="@+id/text_title"
          android:text="This is a title"
          android:layout_gravity="center"
          android:textSize="30sp"
          android:gravity="center"/&gt;
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:id="@+id/btn_edit"
          android:text="Edit"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>It is a simple view; When i use <code>&lt;inclued /&gt;</code> to inflate is ok. But use LayoutInflate will show nothing.</p>
  
  <pre><code>&lt;!--&lt;include--&gt;
          &lt;!--layout="@layout/view_title"/&gt;--&gt;
     &lt;com.example.administrator.test.TitleLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"&gt;
     &lt;/com.example.administrator.test.TitleLayout&gt; 
  </code></pre>
  
  <p>really appreciate your help!!!</p>