I want to use my own font for navigation drawer in android.I use the library comes with android studio according to this answer: https://stackoverflow.com/a/23632492/4393226. But I don't know how to change the font and make it RTL. I searched a lot and I found how to make the drawer RTL. I use this code:
getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
and Android - Is Navigation Drawer from right hand side possible?
But as you know this only works in API 17 and above. Please help! How to change the menu font? How to make the layout RTL in right way?!
Edited: My font "TTF" file is in assets/fonts and I know how to set it for a textview using java, but I don't know how to set it to navigation drawer menu.
You can do this in more easy way.
First go in style.xml and create there a new style.
<style name="RobotoTextViewStyle" parent="android:Widget.TextView">
<item name="android:fontFamily">@font/sans-serif-smallcaps</item>
</style>
and the second is go to your navigation xml code and put the item text appearance there.
app:itemTextAppearance="@style/RobotoTextViewStyle"
now your final navigation code should be this.
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:itemTextAppearance="@style/RobotoTextViewStyle"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_home"
app:menu="@menu/activity_home_drawer" />