在导航视图中更改项目文本大小 [英] Changing the item text size in navigation view
本文介绍了在导航视图中更改项目文本大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在android中创建一个导航抽屉,并且已在menu_main.xml中添加了项目,但无法更改菜单项的大小.下面是代码menu_main.xml:
I am creating a navigation drawer in android and I have added the items in menu_main.xml but I am not able to change the size of the menu items. Below is the code menu_main.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/motel"
android:title="Motel">
</item>
<item
android:id="@+id/packages"
android:title="Packages">
</item>
</group>
</menu>
推荐答案
使用 app:theme
<style name="NavigationViewStyle">
<item name="android:textSize">20sp</item> <!-- menu item text size-->
<item name="android:listPreferredItemHeightSmall">40dp</item><!-- menu item height-->
</style>
然后,如前所述,使用 app:theme
And then as said, apply this style to NavigationView using app:theme
<android.support.design.widget.NavigationView
...
...
app:theme="@style/NavigationViewStyle"
...
...
</android.support.design.widget.NavigationView>
这篇关于在导航视图中更改项目文本大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文