Leonardo Vinsen
Dec 21, 2020

Hi Ritu, I have not tried this yet, but I can give you some pointers.

Firstly, you need to know the width of the tab at runtime and draw the indicator above the active tab. In my case, I used a fixed-width tab which is easier to calculate.

Then, use TabLayout's OnTabSelectedListener or TabLayoutOnPageChangeListener to determine the active tab position. Use this value to determine where to draw the indicator.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response