title: Setting text color in custom sliding tab view on first display
body: <p>I'm trying so set the text color on sliding tabs within a custom view according to the tab state. It's working but not on initial display.</p>
  
  <p>The textcolor in the custom view should be <strong>white</strong> when the tab is <strong>selected</strong> and <strong>darker grey</strong> otherwise. I got it partly working already: When I select a tab manually the text color changes correctly.</p>
  
  <p>My problem is that on first display the text of the <strong>first tab</strong>, whose content is displayed initially and before any user interaction with the tabs, is <strong>not colored in the active state color</strong> (white). Its grey, like the inactive tabs. If I start interacting with the tabs, everything works, but the initial tab color of the first displayed tab is wrong.</p>
  
  <pre><code>[FIRST TAB | SECOND TAB]
       ^
      Grey (inactive color) on first load
  </code></pre>
  
  <p><strong>EDIT:</strong>
  The cause seems to be in the styles.xml: If I declare a custom style that inherits from <em>Widget.Design.TabLayout</em> the initial coloring does not work anymore. If I do not declare custom styles for the tablayout, everything works fine!</p>
  
  <p><strong>EDIT2:</strong>
  No, it doesn't work. It works without setting the custom view but it still does not do the initial coloring correctly when first loading the tabs with setting the custom view.</p>
  
  <p>Here is my code:</p>
  
  <p><strong>tab_gallerylayout.xml</strong> (custom tab view)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  &lt;com.mbprojects.retro.view.RetroTextView
      android:id="@+id/tab_title"
      android:layout_height="wrap_content"
      android:layout_width="wrap_content"
      android:textColor="@drawable/gallerytab_title_color"
      app:font="@string/font_name_syncopate"
      /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>gallerytab_title_color.xml</strong> (selector)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:state_selected="true" android:color="@android:color/white" /&gt;
      &lt;item android:state_selected="false" android:color="@android:color/darker_gray" /&gt;
      &lt;item android:state_focused="true" android:color="@android:color/white" /&gt;
      &lt;item android:state_pressed="true" android:color="@android:color/white" /&gt;
  
      &lt;item android:color="@android:color/darker_grey" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p><strong>styles.xml</strong> </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
  &lt;style name="AppTheme" parent="@style/Theme.AppCompat.NoActionBar"&gt;
  &lt;/style&gt;
  &lt;style name="AppTheme.Base.Widget.Design.TabLayout" parent="Widget.Design.TabLayout"&gt;
      &lt;item name="tabMaxWidth"&gt;@dimen/tab_max_width&lt;/item&gt;
      &lt;item name="tabIndicatorColor"&gt;@android:color/white&lt;/item&gt;
      &lt;item name="tabIndicatorHeight"&gt;0dp&lt;/item&gt;
      &lt;item name="tabPaddingStart"&gt;12dp&lt;/item&gt;
      &lt;item name="tabPaddingEnd"&gt;12dp&lt;/item&gt;
      &lt;item name="tabBackground"&gt;@android:color/black&lt;/item&gt;
      &lt;item name="tabTextAppearance"&gt;@style/TextAppearance.Design.Tab&lt;/item&gt;
  
  &lt;/style&gt;
  </code></pre>
  
  <p></p>
  
  <p>Any suggestions?</p>