[英]Android - NavigationView menu - add margin between groups
I have these two groups inside NavigationView menu XML:我在 NavigationView 菜单 XML 中有这两组:
<group>
<item
android:id="@+id/nav_top"
android:icon="@drawable/ic_flame"
android:checkable="true"
android:title="@string/top_rated" />
<item
android:id="@+id/nav_latest"
android:icon="@drawable/ic_clock"
android:checkable="true"
android:title="@string/latest_uploads" />
</group>
<group>
<item
android:id="@+id/nav_allvids"
android:icon="@drawable/ic_flame"
android:checkable="true"
android:title="@string/top_rated" />
<item
android:id="@+id/nav_allpics"
android:icon="@drawable/ic_shuffle"
android:checkable="true"
android:title="@string/random" />
</group>
I need to add space between them, the solution here: How can I increase margin between two particular groups?我需要在它们之间添加空间,这里的解决方案是: 如何增加两个特定组之间的边距? in Navigation Drawer is bad because the space is too much.
在 Navigation Drawer 中很糟糕,因为空间太大了。
So how can I do that?那我该怎么做呢?
Add this to your dimens.xml
:将此添加到您的
dimens.xml
:
<dimen name="design_navigation_separator_vertical_padding">16dp</dimen>
(This value defines the top and bottom padding for the groups of the com.google.android.material.navigation.NavigationView
) (该值定义了
com.google.android.material.navigation.NavigationView
组的顶部和底部填充)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.