According to source code of NavigationView found here, it led me to NavigationMenuPresenter (found here) which says, every normal type in menu list inflates R.layout.design_navigation_item
. So if you preview it (here) you will notice what preference it uses.
<android.support.design.internal.NavigationMenuItemView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
android:paddingRight="?attr/listPreferredItemPaddingRight"
android:foreground="?attr/selectableItemBackground"
android:focusable="true"/>
So, the final step is to override the style attribute, i.e. layout_height
which references to "?attr/listPreferredItemHeightSmall" (default 48dp)
.
Open your styles.xml and override it by i.e using custom value:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<!-- HERE-->
<item name="listPreferredItemHeightSmall">18dp</item>
</style>
Original:
Custom:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…