I would like to get the background of the tab animated smoothly to the selected position (just like the default tabIndicator
animates between tabs).
Here is
Check the @Maulik answer. It is what you are looking for.
Just to integrate the answer, without a custom shape (in your example you are using it) you can just use:
The INDICATOR_GRAVITY_STRETCH allows you to stretch the tab selection indicator across the entire height and width. In this way you can just use the app:tabIndicatorColor
without drawable to set the selected color used.
The animation is provided by default.