我正在使用适用于 Android的新Google 材料组件
目前,我正在尝试为 Tablayout (com.google.android.material.tabs.TabLayout) 提供自定义外观。
我创建了如下样式:
<style name="AppTheme.TabLayout" parent="Widget.MaterialComponents.TabLayout">
<item name="android:background">@color/colorPrimary</item>
</style>
但是,应用此主题后,选项卡指示器将变为不可见。
无主题:
带主题:
另外,我尝试了其他方法,例如更改 tabIndicatorColor,但仍然无法正常工作!
我该如何解决?更改材质组件颜色/主题的正确方法是什么?