How to change the font of the NavigationView header and menu items with the latest platform update for fonts?

Viewed 281

I'm trying to change the font of the my NavigationView header. I've tried to set the fontFamily attribute of the text view of the custom header I made, but with no use. here's my custom header

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="160dp"
android:background="@color/colorAccent">

<de.hdodenhof.circleimageview.CircleImageView
    android:id="@+id/civ_user_image"
    android:layout_width="72dp"
    android:layout_height="72dp"
    android:layout_centerVertical="true"
    android:layout_marginStart="4dp"
    android:src="@drawable/dummy" />

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_marginStart="16dp"
    android:layout_toEndOf="@id/civ_user_image"
    android:orientation="vertical">

    <TextView
        android:id="@+id/tv_user_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/cairo_bold"
        android:text="Kareem Waleed"
        android:textColor="@color/white"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/tv_user_email"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/cairo_semi_bold"
        android:text="kareemwaleed31@gmail.com"
        android:textColor="@color/white"
        android:textSize="14sp" />
</LinearLayout>

</RelativeLayout>

Am also trying to change the font of he NavigationView items, I've tried many solutions including the one involving making a custom style and use it by app:theme but it's not working for font or font family, it works fine with size.

here is my NavigationView

    <android.support.design.widget.NavigationView
    android:id="@+id/nv_navigation_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@color/white"
    app:menu="@menu/navigation_drawer_items"
    app:headerLayout="@layout/navigation_drawer_header" />

any help with this ?

0 Answers
Related