title: TabLayout position at the bottom of the screen
body: <p>I'm using <em>android.support.design.widget</em> and I need to set the position of <strong>TabLayout</strong> at the <code>activity_main.xml</code> in the <strong>bottom of the screen</strong>.</p>
  
  <p>I've seen that you can use TabHost, but I prefer to use <em>android.support.design</em></p>
  
  <p><strong>ativity_main.xml</strong></p>
  
  <p></p>
  
  <pre><code>&lt;android.support.design.widget.AppBarLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
      &lt;android.support.design.widget.TabLayout
          android:id="@+id/tabs"
          android:layout_width="match_parent"
          android:layout_height="@dimen/custom_tab_layout_height"
          app:tabMode="fixed"
          app:tabGravity="fill"/&gt;
  &lt;/android.support.design.widget.AppBarLayout&gt;
  
  &lt;android.support.v4.view.ViewPager
      android:id="@+id/viewpager"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      viewPager = (ViewPager) findViewById(R.id.viewpager);
      setupViewPager(viewPager);
  
      tabLayout = (TabLayout) findViewById(R.id.tabs);
      tabLayout.setupWithViewPager(viewPager);
  
  
      TextView tabOne = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
      tabOne.setText("ONE");
      tabOne.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_tab_call, 0, 0);
      tabLayout.getTabAt(0).setCustomView(tabOne);
  
  
      TextView tabTwo = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
      tabTwo.setText("TWO");
      tabTwo.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.iconos, 0, 0);
      tabLayout.getTabAt(1).setCustomView(tabTwo);
  
  }
  
  private void setupViewPager(ViewPager viewPager) {
      ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
      adapter.addFrag(new OneFragment(), "");
      adapter.addFrag(new TwoFragment(), "");
      adapter.addFrag(new ThreeFragment(), "");
      viewPager.setAdapter(adapter);
  }
  
  class ViewPagerAdapter extends FragmentPagerAdapter {
      private final List&lt;Fragment&gt; mFragmentList = new ArrayList&lt;&gt;();
      private final List&lt;String&gt; mFragmentTitleList = new ArrayList&lt;&gt;();
  
      public ViewPagerAdapter(FragmentManager manager) {
          super(manager);
      }
  
      @Override
      public Fragment getItem(int position) {
          return mFragmentList.get(position);
      }
  
      @Override
      public int getCount() {
          return mFragmentList.size();
      }
  
      public void addFrag(Fragment fragment, String title) {
          mFragmentList.add(fragment);
          mFragmentTitleList.add(title);
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          return mFragmentTitleList.get(position);
      }
  }
  </code></pre>
  
  <p>Any ideas?
  Thanks.</p>