title: TabLayout update tab content with a custom view
body: <p>I'm using <code>TabLayout</code> of the new material design and i have a problem, i can't update tab content of a custom view once the tab is created:</p>
  
  <p>I can simplify my method inside my PagerAdapter with</p>
  
  <pre><code>public View setTabView(int position, boolean selected) {
      View v = LayoutInflater.from(context).inflate(R.layout.default_tab_view, null);
      tv = (TextView) v.findViewById(R.id.tabTextView);
      if(selected)
          tv.setText("SELECTED");
      else 
          tv.setText("UNSELECTED");       
      return v;
  }
  </code></pre>
  
  <p>And in activity i can simplify my code with:</p>
  
  <pre><code>TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
  ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
  PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager());
  pager.setAdapter(adapter);
  tabLayout.setupWithViewPager(pager);
  for (int i = 0; i &lt; tabLayout.getTabCount(); i++) {
      boolean isFirstTab = i == 0;
      TabLayout.Tab tab = tabLayout.getTabAt(i);
      View v;
      v = adapter.setTabView(i, isFirstTab);
      v.setSelected(isFirstTab);
      tab.setCustomView(v);
  }
  
  tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
      @Override
      public void onTabSelected(TabLayout.Tab tab) {
          adapter.setTabView(tab.getPosition(), true);
      }
  
      @Override
      public void onTabUnselected(TabLayout.Tab tab) {
          adapter.setTabView(tab.getPosition(), false);
      }
  
      @Override
      public void onTabReselected(TabLayout.Tab tab) {
  
      }
  });
  </code></pre>
  
  <p>The tabs' titles are set right when the app starts but when i change tab, the content still remains the same.</p>