Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 导航抽屉未启动_Android_Navigation Drawer - Fatal编程技术网

Android 导航抽屉未启动

Android 导航抽屉未启动,android,navigation-drawer,Android,Navigation Drawer,我有导航抽屉,需要打开,但无法>> 这是我的drawer_layout.xml: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="m

我有导航抽屉,需要打开,但无法>>

这是我的drawer_layout.xml:

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- This LinearLayout represents the contents of the screen  -->
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <!-- The ActionBar displayed at the top -->
    <include
        layout="@layout/activity_display"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <!-- The main content view where fragments are loaded -->
    <FrameLayout
        android:id="@+id/flContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

<!-- The navigation drawer that comes from the left -->
<!-- Note that `android:layout_gravity` needs to be set to 'start' -->
<android.support.design.widget.NavigationView
    android:id="@+id/nvView"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="right"
    android:background="@android:color/white"
    app:menu="@menu/drawer_view" />
我不知道为什么我不能开始我的导航绘图。。
我在屏幕上看不到它。

在xml文件中写入结束而不是右键

  android:layout_gravity="right"

或替代解决方案

使用

而不是

mDrawer.openDrawer(GravityCompat.END);

在我改变它之前是这样的,但它不起作用
  android:layout_gravity="right"
 android:layout_gravity="end"
mDrawer.openDrawer(GravityCompat.RIGHT);
mDrawer.openDrawer(GravityCompat.END);