How to highlight selected tab's icon in tab and view pager implementation android?

517 views Asked by At

I want the output as it is shown in this gif

enter image description here

I implemented tabs as mentioned in this tutorial https://guides.codepath.com/android/ViewPager-with-FragmentPagerAdapter . I came across this tutorial https://github.com/ogaclejapan/SmartTabLayout/ , but it has a copyright and licensing on it. But I would like to know if the same could be achieved using in built android functionalities

1

There are 1 answers

0
Kartik Sharma On

This seems fairly easy. You need two set's of each icon. One grey and one white.

When you select an item (TabItem) , change the icon of tab to the white one, and change the icon of last selected tab to grey one.