Android Material Tab Layout indicator with round corners

How to make material Tab Layout indicator with round corners

Ref image enter image description here

Answer

Use this app:tabIndicator property to customized the tab indicator.

Create drawable like below

indicator.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <corners android:topRightRadius="5dp"
                android:topLeftRadius="5dp"/>
            <solid android:color="@color/color_text_black" />
        </shape>
    </item>
</layer-list>

use above XML like below

app:tabIndicator="@drawable/indicator"