[NavigationView] Custom Font resetting back to Roboto (system default) on item click
See original GitHub issueSet <item name="android:fontFamily">@font/montserrat_regular</item>
in styles.xml
- In either main apptheme or
<style name="NavigationView" > <item name="android:fontFamily">@font/montserrat_regular</item> </style>
Custom font is set in navigation drawer, but when selecting an item from the drawer, and after the drawer closes, when the drawer is reopened, the first 5 items from the top has resetted back to the system roboto font.
I have rearranged the list to rule out individual items, but it is always the first five. The custom font remains for the items below.
Expected behavior: The nav items font should always be the same
Source code: The code snippet which is causing this issue. Please consider attaching a minimal sample app that reproduces the issue.
Android API version: Android 10
Material Library version: com.google.android.material:material:1.2.0-alpha04
Device: Pixel 2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:12 (2 by maintainers)
Top GitHub Comments
Found a solution:
Make sure NavigationView DOES NOT use: android:theme=“@style/MyCustomNavStyle”
but use:
app:itemTextAppearance=“@style/MyCustomNavStyle”
<style name="MyCustomNavStyle"> <item name="android:fontFamily">@font/montserrat_regular</item> </style>
Seems to have fixed it
Unbelievable! It works @johnnyzen, thank you!