How can we reduce the gap between tab layout text and its indicator

Try this

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/htab_maincontent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">


    <android.support.design.widget.AppBarLayout
        android:id="@+id/htab_appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#2fff00"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/htab_collapse_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:titleEnabled="false">


            <android.support.v7.widget.Toolbar
                android:id="@+id/htab_toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@android:color/transparent"
                app:contentInsetStart="0dp"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

            <ImageView
                android:id="@+id/htab_header"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/ic_launcher_background"
                app:layout_collapseMode="parallax" />


        </android.support.design.widget.CollapsingToolbarLayout>

        <android.support.design.widget.TabLayout
            android:id="@+id/htab_tabs"
            android:layout_width="match_parent"
            android:layout_height="35dp"
            android:layout_gravity="bottom"
            android:background="@drawable/tab_selector"
            app:layout_anchor="@+id/MyAppbar"
            app:layout_anchorGravity="bottom"
            app:tabGravity="fill"
            app:tabIndicatorColor="#F21757"
            app:tabMode="scrollable"
            app:tabSelectedTextColor="#F21757"
            app:tabTextColor="@android:color/white" />


    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>

drawable/tab_selector

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_selected="true" android:state_pressed="false">
        <layer-list xmlns:android="http://schemas.android.com/apk/res/android">

            <item android:top="-2dp" android:left="-5dp" android:right="-5dp" android:bottom="2dp">
                <shape android:shape="rectangle">

                    <solid android:color="@android:color/white"/>
                    <stroke android:color="@color/colorPrimary" android:width="2dp"/>

                </shape>
            </item>
        </layer-list>
    </item>

    <item android:state_selected="true" android:state_pressed="true">
        <layer-list xmlns:android="http://schemas.android.com/apk/res/android">

            <item android:top="-2dp" android:left="-5dp" android:right="-5dp" android:bottom="2dp">
                <shape android:shape="rectangle">

                    <solid android:color="@android:color/white"/>
                    <stroke android:color="@color/colorPrimary" android:width="2dp"/>

                </shape>
            </item>
        </layer-list>
    </item>

</selector>

You should set the following property

app:tabPaddingBottom="-10dp"