title: TabLayout not displaying tab title on Marshmallow
body: <p>I'm having a strange issue with the titles of my tabs not showing up when I test my app on a marshmallow device. When I test it on all other devices, the titles show up just fine. While debugging, the device hits all of the same points including the the "getPageTitle" method inside my adapter. I've read through many tutorials for using android's TabLayout and ViewPager, just to make absolutely certain I'm not missing anything, and from what I can tell, I am not doing anything wrong. </p>
  
  <p>Here is the code in my main activity,</p>
  
  <pre><code>// setup viewPager
  final ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
  setupViewPager(viewPager);
  
  // setup tabLayout
  TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
  tabLayout.setupWithViewPager(viewPager);
  viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
  </code></pre>
  
  <p>my setUpViewPager() method,</p>
  
  <pre><code>private void setupViewPager(ViewPager viewPager) {
      ViewPagerAdapter adapter = new ViewPagerAdapter(getFragmentManager());
      viewPager.setAdapter(adapter);
  }
  </code></pre>
  
  <p>and my adapter class which extends FragmentPagerAdapter</p>
  
  <pre><code>private class ViewPagerAdapter extends FragmentPagerAdapter {
      private static final int NUM_FRAGMENTS = 2;
  
      public ViewPagerAdapter(FragmentManager fm) {
          super(fm);
      }
  
      @Override
      public Fragment getItem(int position) {
          switch (position) {
              case 0: return AllFeaturesFragment.newInstance();
              case 1: return CategoriesFragment.newInstance();
          }
          return null;
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          switch (position) {
              case 0: return "All Features";
              case 1: return "Categories";
          }
          return null;
      }
  
      @Override
      public int getCount() {
          return NUM_FRAGMENTS;
      }
  }
  </code></pre>
  
  <p>Any help is greatly appreciated!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>It never occurred to me to check the xml file for the answer, but I was using a style on the TabLayout element whose parent style was "Widget.AppCompat.Toolbar". For some reason this style made the titles invisible on marshmallow devices and none others. All I had to do was remove the style and it worked fine!</p>