'The font attribute not overriding theme
Adding fontFamily in the view in the layout doesn't effect anything , it should override the theme as explained by the instructor, it should override because attribute have highest priority .
<TextView
android:fontFamily="monospace"
/>
Styles.xml
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="fontFamily">@font/lobster</item>
<item name="android:fontFamily">@font/lobster</item>
</style>
But the font attribute doesn't override
Solution 1:[1]
Use @font/monospace inside TextView
<TextView
android:fontFamily="@font/monospace"
/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Manohar |
