title: Highlight the first item in view pager when the activity loads while using custom view with tab layout?
body: <p>I am working on tabs like the youtube app and would like to highlight the first page on load of the activity so i used the following code </p>
  
  <pre><code>viewpager.setCurrentItem(0);//which does not highlight first tab onstarting the tab activity
  </code></pre>
  
  <p>And i used  drawable as background for the icons in tablayout . I set the background of drawable on create of fragment by getting each child of tablayout . I set the text color in </p>
  
  <pre><code>&lt;item name="tabTextAppearance"&gt;@style/TabTextAppearance&lt;/item&gt;
  
  &lt;/style&gt;
  &lt;style name="TabTextAppearance" parent="TextAppearance.Design.Tab"&gt;
      &lt;item name="android:textColor"&gt;@color/tab_text_selector&lt;/item&gt;
      &lt;item name="android:textAllCaps"&gt;false&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>One of the selector files </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:drawable="@drawable/favorite_selected" /&gt;
          &lt;item android:state_focused="true" android:drawable="@drawable/favorite_selected" /&gt;
          &lt;item android:state_pressed="true" android:drawable="@drawable/favorite_selected" /&gt;
          &lt;item android:drawable="@drawable/favorites" /&gt;
      &lt;/selector&gt;
  </code></pre>
  
  <p>There are two other drawables and i am using custom layout for tabs 
  How can i show the first item highlighted when the app loads in view pager</p>