Project with MDC doesn't follow the fontFamily
I set in Headline 6 in my theme when on dark theme.
I used metropolis_500 as my fontFamily
in my Headline 6 style. It shows up normally on Light Theme but not on Dark Theme.
implementation 'com.google.android.material:material:1.1.0'
<!--Base Theme-->
<style name="Base.Theme.MyApp" parent="Base.Theme.MaterialThemeBuilder">
...
<item name="textAppearanceHeadline6">@style/TextAppearance.MyTheme.Headline6</item>
<item name="toolbarStyle">@style/Widget.MyTheme.Toolbar.AppBar</item>
...
</style>
<!--AppBar Style-->
<style name="Widget.MyTheme.Toolbar.AppBar" parent="Widget.MaterialComponents.Toolbar.Surface">
<item name="android:background">?attr/colorAppBar</item>
<item name="titleTextColor">?colorOnAppBar</item>
</style>
<!--Headline 6-->
<style name="TextAppearance.MyTheme.Headline6" parent="TextAppearance.MaterialComponents.Headline6">
<item name="fontFamily">@font/metropolis_500</item>
</style>
I tried explicitly specifying the use of Headline 6 in my AppBar Style and did not work.
<!--AppBar Style-->
<style name="Widget.MyTheme.Toolbar.AppBar" parent="Widget.MaterialComponents.Toolbar.Surface">
<item name="android:background">?attr/colorAppBar</item>
<item name="titleTextColor">?colorOnAppBar</item>
<item name="titleTextAppearance">@style/TextAppearance.MyTheme.Headline6</item>
</style>
I also tried explicitly specifying the toolbarStyle
on Dark Theme Style.
<style name="Theme.MyApp" parent="Base.Theme.MyApp">
...
<item name="toolbarStyle">@style/Widget.MyTheme.Toolbar.AppBar</item>
</style>
I also tried reverting to the default Material Components toolbarStyle.
<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Surface</item>
Nothing worked. Light theme is alright, but dark theme isn't. The metropolis font shows up properly on other parts in dark theme like in TextViews
that use the Headline 6 style.