I'm trying to change the font of my navigation drawer's items but its not working. I'm setting it to a specific theme/style, the Material Design Button text. I've got it working for the Toolbar (Actionbar) but I can't seem to change the navigation drawer's items' text at all.
I'm trying to set this: NavDrawer
into this font/style: Toolbar Style
.
I've tried changing the "app" attributes in the NavigationView but it doesn't work for me. Here's my layout.xml and my styles.xml.
Any help or suggestions are welcome, Thanks!
Layout.xml:
<android.support.design.widget.CoordinatorLayout>
<LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/fragment_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/transparent"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light"
app:titleTextAppearance="@style/TextAppearance.AppTheme.Toolbar">
</android.support.v7.widget.Toolbar>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
style="@style/Widget.MaterialComponents.NavigationView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/themePrimaryLight"
app:elevation="8dp"
app:headerLayout="@layout/nav_header"
app:itemIconPadding="60dp"
app:itemIconTint="@color/colorSecondLight"
app:itemTextAppearance="@font/rubik_regular"
app:itemTextColor="@color/colorSecondLight"
app:menu="@menu/nav_drawer_base" />
</android.support.v4.widget.DrawerLayout>
Styles.xml:
<resources>
<!-- 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/colorSecondDark</item>
<item name="android:statusBarColor">@color/fullAlpha</item>
</style>
<style name="AppThemeActionBar" parent="Theme.MaterialComponents.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorSecondDark</item>
</style>
<style name="Widget.AppTheme.Toolbar" parent="Widget.AppCompat.Toolbar">
<item name="titleTextAppearance">@style/TextAppearance.AppTheme.Toolbar</item>
</style>
<style name="TextAppearance.AppTheme.Toolbar" parent="TextAppearance.MaterialComponents.Button">
<item name="android:textSize">16sp</item>
</style>
<style name="NavigationDrawerStyle">
<item name="android:textSize">14sp</item>
<item name="android:itemTextAppearance">@style/TextAppearance.AppTheme.Toolbar</item>
</style>
</resources>