title: Extending RelativeLayout by inflating from xml?
body: <p>I want to create a class named TabView which extends RelativeLayout and it is inflated from xml that contains RelativeLayout. The thing is that it doesn't seem to work as I expected. Did I do something wrong in the constructor? I know layoutInflater.inflate returns View object but what do I have to make it equal to? Any advice is apprecited!</p>
  
  <pre><code>private class TabView extends RelativeLayout {
      private int mIndex;
  
      public TabView(Context context) {
          super(context, null, R.attr.vpiTabPageIndicatorStyle);
          LayoutInflater layoutInflater = LayoutInflater.from(context);
          layoutInflater.inflate(R.layout.tabview_title_subtitle, null);
      }
  
      public int getIndex() {
          return mIndex;
      }
  
      public void setTitle() {
          TextView title = (TextView)findViewById(R.id.title);
          title.setText("Followers");
      }
  
      public void setSubitle() {
          TextView subtitle = (TextView)findViewById(R.id.subtitle);
          subtitle.setText("435");
      }
  }
  </code></pre>
  
  <p>The following is tabview_title_subtitle.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;TextView
          android:id="@+id/title"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:text="Title"
          android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
      &lt;TextView
          android:id="@+id/subtitle"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_below="@+id/title"
          android:text="Subtitle"
          android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>