title: Tab indicator no longer at the bottom of AppBarLayout after migrating app to AndroidX. The tab is custom made tab
body: <p>I migrated android app to AndroidX and then I noticed this </p>
  
  <p><a href="https://i.stack.imgur.com/Ylitb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ylitb.png" alt="enter image description here"></a></p>
  
  <p>As you can see the tab indicator went up into the AppBarLayout. Here is the code </p>
  
  <pre><code>&lt;com.google.android.material.appbar.AppBarLayout
      android:id="@+id/appbar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:layout_constraintTop_toTopOf="parent"
      android:paddingTop="@dimen/appbar_padding_top"
      android:theme="@style/AppTheme.AppBarOverlay"
      android:elevation="4dp"&gt;
  
      &lt;androidx.appcompat.widget.Toolbar
          ... // some code here relevant to toolbar
      &lt;/androidx.appcompat.widget.Toolbar&gt;
  
      &lt;com.google.android.material.tabs.TabLayout
          android:id="@+id/tabs"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;com.google.android.material.tabs.TabItem
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout="@layout/custom_tab" /&gt;
  
          &lt;com.google.android.material.tabs.TabItem
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout="@layout/custom_tab" /&gt;
  
          &lt;com.google.android.material.tabs.TabItem
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout="@layout/custom_tab"/&gt;
  
      &lt;/com.google.android.material.tabs.TabLayout&gt;
  
  &lt;/com.google.android.material.appbar.AppBarLayout&gt;
  </code></pre>
  
  <p>The custom layout I created is below: </p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
         &lt;androidx.constraintlayout.widget.ConstraintLayout 
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"&gt;
  
        &lt;TextView
         android:id="@+id/tab_title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         tools:text="CONTRIBUTIONS"
         style="@style/TextAppearance.Design.Tab"/&gt;
  
         &lt;TextView
         android:id="@+id/tv_number"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintTop_toBottomOf="@id/tab_title"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         tools:text="1000"
         android:layout_marginBottom="8dp"
         style="@style/TextAppearance.Design.Tab"
         /&gt;
  
         &lt;TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginStart="8dp"
         android:layout_marginLeft="8dp"
         android:layout_marginEnd="4dp"
         android:layout_marginRight="4dp"
         android:text="@string/open_bracket"
         app:layout_constraintBottom_toBottomOf="@+id/tv_number"
         app:layout_constraintEnd_toStartOf="@+id/tv_number"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="@+id/tv_number"
         app:layout_constraintHorizontal_bias="1"
         style="@style/TextAppearance.Design.Tab"/&gt;
  
         &lt;TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginStart="4dp"
         android:layout_marginLeft="4dp"
         android:layout_marginEnd="8dp"
         android:layout_marginRight="8dp"
         android:text="@string/closing_bracket"
         app:layout_constraintBottom_toBottomOf="@+id/tv_number"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toEndOf="@+id/tv_number"
         app:layout_constraintTop_toTopOf="@+id/tv_number"
         app:layout_constraintHorizontal_bias="0"
         style="@style/TextAppearance.Design.Tab"/&gt;
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;`
  </code></pre>
  
  <p>It looks fine in android 22 and below but not android 24 and above. However before this migration to androidx it was fine in all versions i.e the indicator was at bottom of appbarlayout not inside it.</p>