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.
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)?
Scouring through the source code I found this layout file
with the following attribute
Which meant all we had to do was to override the
textAppearanceListItem
style in our project.res/values/styles.xml
I'm not totally sure what else this will affect but if anyone has a better answer I'd be happy to accept that instead!
List Adapter Layout of your Navigation bar:
This param in RelativeLayout set the background color --> android:background="@drawable/pressed_state"
Make this "pressed_state.xml" in drawable folder.
Excuse me for my english.
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:app:theme="@style/yourStyle.Drawer"
to yourNavigationView
in your layout.xmlandroid:textSize="16sp"
in styleyourStyle.Drawer
you can use this attributes inside xml file
or for small text
or for large text
You can customize everything from text color to size and font in your style.xml
and then in your
NavigationView
:create style
add it to your main_layout.xml
all params (which you can change) are located here change the navigation items.
Also you can override
*.xml
file (copy file from...\sdk\extras\android\support\design\res\layout\design_navigation_item.xml
), just in yourapp/src/main/res/layout
folder create a layout named:design_navigation_item.xml
all layouts which can be Overriden are located here
...\sdk\extras\android\support\design\res\layout\
[UPDATE] Each version of
com.android.support:design-{version}
lib has different items to override. Check all what you need in