Closed CodeRedDev closed 4 years ago
Hi @CodeRedDev,
Seems we are mutating your drawable when you use it for both background and tabIndicator. Can you duplicate the resource and use two different references?
I sent a fix https://github.com/material-components/material-components-android/commit/bbd645a34179b643ed9d096cdf5dfd4ca1710d0f
for the root cause
Yeah the quick fix seems to work. Thank you very much. I also learned something pretty interesting from this issue about drawables :)
Description: When setting
android:background
to a ShapeDrawable the set color in this drawable will not be inflated correctly everytime. In the example app provided below you'll even see it working correctly only once. This seems to have something to do with drawables I think, because ifbackground
is set to a color it will work as expected.Expected behavior: The set drawable should be correctly inflated.
Source code: https://github.com/CodeRedDev/TabLayout-Background-Error
Android API version: 28
Material Library version: 1.1.0 (also tested with 1.2.0-alpha04)
Device: HTC U11+ API 28