我的问题是关于最近从Design Support Library
发布的Navigation View
。 如何在导航视图中定位菜单项?
我想在Navigation View
的底部设置Log In
,我该怎么做? 我的菜单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_sub_item_1"
android:icon="@drawable/ic_action_event"
android:title="@string/home" />
<item
android:id="@+id/navigation_sub_item_2"
android:icon="@drawable/ic_action_person"
android:title="@string/profile" />
<item
android:id="@+id/navigation_sub_item_3"
android:icon="@drawable/ic_action_labels"
android:title="@string/tags" />
<item
android:id="@+id/navigation_sub_item_4"
android:icon="@drawable/ic_action_settings"
android:title="@string/log_in" />
</group>
</menu>
这里是我的布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@color/white_1000">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/main_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/drawer_menu" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
对于组导航视图菜单位置[见此答案] [1] [1]:http://stackoverflow.com/a/31753244/4395114 –