【发布时间】:2015-06-28 02:16:42
【问题描述】:
我有一个 DrawerLayout,里面有一个 NavigationView(支持设计库)。我已经能够设置标题并将项目添加到视图中,但我希望一些项目有更小的文本、没有图标等......我不知道在哪里指定新属性。在我的drawer.xml中,其他项目在哪里,我不知道哪些属性可以改变它。
感谢任何建议!
我有两个具有预期外观的项目,最后一个项目,注销,我想缩小它的大小并为其设置一个分隔开销。
layout/activity_main.xml
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<LinearLayout
android:orientation="vertical"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/fragment_navdrawer_header"
app:menu="@menu/drawer"/>
</android.support.v4.widget.DrawerLayout>
menu/drawer.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/navigation_item_1"
android:icon="@drawable/ic_action_social_school"
android:title="Courses"/>
<item
android:id="@+id/navigation_item_2"
android:icon="@drawable/ic_action_action_grade"
android:title="Grades"/>
<item
android:id="@+id/navigation_logout"
android:title="Logout"
/>
</group>
</menu>
【问题讨论】:
-
您找到解决方案了吗?尽管我正在考虑将导航视图和另一个视图放入单个视图组中,但我也面临着这个问题。我想知道这是否可行?
标签: java android xml androiddesignsupport navigationview