java 如何更改导航视图菜单项和文本的大小?如何更改菜单之间的空间?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32382563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 20:07:12  来源:igfitidea点击:

how to change size of navigation view menu items and text?? How to change space between menu?

javaandroidspacenavigationview

提问by bond007

I am making a sliding menu. I have successfully created a navigation drawer and menu items inside the navigation view in groups. But I want to make the items closer to each other. Can I change the spacing or size of items and text? Please help...

我正在制作一个滑动菜单。我已经成功地在导航视图中创建了一个导航抽屉和菜单项。但我想让这些项目彼此更接近。我可以更改项目和文本的间距或大小吗?请帮忙...

采纳答案by Amrut

Create following Theme in your styles.xml for Navigation Drawer and you're done.

在你的 style.xml 中为导航抽屉创建以下主题,你就完成了。

<style name="NavigationTheme" parent="AppTheme">
    <item name="android:textSize">16sp</item>
    <item name="android:layout_marginBottom">02dp</item>
</style>

Apply this theme to your navigation drawer layout

将此主题应用于您的导航抽屉布局

回答by bond007

You can apply following Theme in your styles.xml for Navigation Drawer

您可以在styles.xml 中为导航抽屉应用以下主题

<style name="NavigationTheme" parent="AppTheme">
    <item name="android:textSize">14sp</item>
    <item  name="android:textStyle">bold</item>
</style>

Apply this theme in Navigation Drawer

在导航抽屉中应用此主题

android:theme="@style/NavigationTheme"