Jay Jay - 2 months ago 14
Android Question

How can I change the NavigationView's item text size?

Google recently released the

android.support.design.widget.NavigationView
widget as part of the
com.android.support:design:22.2.0
library, which greatly simplified (and standardises) the process of creating a NavigationDrawer.

However according to the design specs, the list item should be Roboto Medium, 14sp, 87% #000000. The
NavigationView
exposes no
textSize
or
textStyle
to customise this.

Material design specs
Font style info

What are my options if I'm pedantic about maintaining the correct design specifications using the Google provided
NavigationView
(or customising it in any other way)?

Answer

Since Android Support Library 22.2.1, Google has changed default textSize of items in NavigationView from 16sp to 14sp, which suits Material Design guideline well. However, in some cases(for example, when you want to support Chinese language), it seems larger textSize is better. Solution is simple:

  1. add app:theme="@style/yourStyle.Drawer" to your NavigationView in your layout.xml
  2. in styles.xml, add android:textSize="16sp" in style yourStyle.Drawer
Comments