title: Android tabs custom view
body: <p>I am adding tabs to my app with this code:</p>
  
  <pre><code>ActionBar.Tab tab1=actionBar.newTab();
  tab1.setTabListener(this);
  tab1.setCustomView(R.layout.tab_style);
  TextView txt1 = (TextView)tab1.getCustomView().findViewById(R.id.tabtext);
  txt1.setText(R.string.tab_1);
  actionBar.addTab(tab1);
  </code></pre>
  
  <p>And this is the tab_style.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!-- This is the main layout of the application --&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/fragment_basic_root"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="@color/white" 
      android:paddingBottom="15dp"
      &gt;
  
  
  &lt;TextView
      android:id="@+id/tabtext"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:gravity="center_vertical"
      android:paddingLeft="6dip"
      android:minHeight="?android:attr/listPreferredItemHeight"
      android:textSize="20dp"
  /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I want to change tab background,but result:</p>
  
  <p><img src="https://i.stack.imgur.com/Cd3pC.jpg" alt="enter image description here"></p>
  
  <p>How can I fix it ? Customview is not centering.</p>