[TabLayout] Indicator with tabIndicatorFullWidth=false does not match label if label is not centered
See original GitHub issueDescription:
I have this style
<style name="TabLayoutStyle" parent="Widget.MaterialComponents.TabLayout">
<item name="tabIndicatorFullWidth">false</item>
<item name="tabMode">scrollable</item>
<item name="tabPaddingStart">0dp</item>
<item name="tabPaddingEnd">16dp</item>
<item name="tabGravity">start</item>
<item name="tabContentStart">0dp</item>
<item name="tabMinWidth">0dp</item>
</style>
and it renders as this

Expected behavior:
Indicator should match label width
Android API version: 29
Material Library version: 1,3.0-alpha01
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Android Tab layout: Wrap tab indicator width with respect to ...
Yes, it's possible to wrap tab indicator as title setting padding to 0 ... If you don't need the strip to be smaller...
Read more >TabLayout | Android Developers
Returns whether tab labels will be displayed inline with tab icons, or if they will be displayed underneath tab icons. boolean ...
Read more >Custom TabLayout Indicator in — Android. | by Danish Amjad
Custom TabLayout Indicator on Android 9.0. The issue was it's not picked up the color which I defined in my drawable, now let's...
Read more >All-in-One — Android TabLayout and TabItem | by Myrick Chow
Do not use app:tabIndicatorHeight to change the height of indicator since it ... time and each tab has equal width which is based...
Read more >Tabs - Material Design
TabItem s can then be added as children of the TabLayout and adjusted as needed: ... Active tab indicator; Inactive icon (optional if...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Is there a workaround for this? Or will you accept a PR with a fix?
after a quick look, it seems that tabViewCenterX should take paddings into account
in https://github.com/material-components/material-components-android/blob/0afcb48f14a7af3db3712be44d7984c8d89e25fb/lib/java/com/google/android/material/tabs/TabIndicatorInterpolator.java#L80
UPD as a workaround you can use equal start/end paddings and just translate the whole TabLayout by difference between original padding and new one. e.g.
can be achieved as
Is this fixed?