Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.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
Java 为什么我的导航抽屉没有';t出现?(仅汉堡包图标)_Java_Android_Xml_Android Layout_Navigation Drawer - Fatal编程技术网

Java 为什么我的导航抽屉没有';t出现?(仅汉堡包图标)

Java 为什么我的导航抽屉没有';t出现?(仅汉堡包图标),java,android,xml,android-layout,navigation-drawer,Java,Android,Xml,Android Layout,Navigation Drawer,您好,我正在做一个滑动标签,如果您向上滑动工具栏将隐藏现在我正在放置导航抽屉。我的导航抽屉不会出现,只有汉堡图标出现。但是如果我要把我抽屉的标签放在我的浏览页面下。抽屉可以很好地工作,但我的回收器视图上的列表不会出现。我认为我的xml有问题,或者它的位置不匹配。有什么建议吗?下面是我的活动_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas

您好,我正在做一个滑动标签,如果您向上滑动工具栏将隐藏现在我正在放置导航抽屉。我的导航抽屉不会出现,只有汉堡图标出现。但是如果我要把我抽屉的标签放在我的浏览页面下。抽屉可以很好地工作,但我的回收器视图上的列表不会出现。我认为我的xml有问题,或者它的位置不匹配。有什么建议吗?下面是我的活动_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:orientation="vertical">


    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/coordinatorLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">


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

            <FrameLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/containerView">
            </FrameLayout>

            <android.support.design.widget.NavigationView
                xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="start"
                android:id="@+id/shitstuff"
                app:itemTextColor="@color/black"
                app:menu="@menu/drawermenu"
                android:layout_marginTop="-24dp" />

        </android.support.v4.widget.DrawerLayout>
        <!-- AppBar Layout   -->
        <android.support.design.widget.AppBarLayout

            android:id="@+id/appBarLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="fill_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:layout_scrollFlags="scroll|enterAlways"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                android:title="Android Testing"/>
            <!-- Tab Layout for creating tabs -->
            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                app:tabGravity="fill"
                app:tabMode="fixed"
                android:background="@color/material_blue_grey_800"
                app:tabIndicatorColor="@color/main_color"
                app:tabSelectedTextColor="@color/main_color"
                app:tabTextColor="@color/white"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            </android.support.design.widget.TabLayout>
        <!-- Helps handing the Fragments for each Tab -->
        </android.support.design.widget.AppBarLayout>

        <android.support.v4.view.ViewPager
            android:id="@+id/viewPager"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    </android.support.design.widget.CoordinatorLayout>

</LinearLayout>
activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:orientation="vertical">


    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/coordinatorLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">


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

            <FrameLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/containerView">
            </FrameLayout>

            <android.support.design.widget.NavigationView
                xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="start"
                android:id="@+id/shitstuff"
                app:itemTextColor="@color/black"
                app:menu="@menu/drawermenu"
                android:layout_marginTop="-24dp" />

        </android.support.v4.widget.DrawerLayout>
        <!-- AppBar Layout   -->
        <android.support.design.widget.AppBarLayout

            android:id="@+id/appBarLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="fill_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:layout_scrollFlags="scroll|enterAlways"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                android:title="Android Testing"/>
            <!-- Tab Layout for creating tabs -->
            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                app:tabGravity="fill"
                app:tabMode="fixed"
                android:background="@color/material_blue_grey_800"
                app:tabIndicatorColor="@color/main_color"
                app:tabSelectedTextColor="@color/main_color"
                app:tabTextColor="@color/white"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            </android.support.design.widget.TabLayout>
        <!-- Helps handing the Fragments for each Tab -->
        </android.support.design.widget.AppBarLayout>

        <android.support.v4.view.ViewPager
            android:id="@+id/viewPager"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    </android.support.design.widget.CoordinatorLayout>

</LinearLayout>

试试这个:

    <?xml version="1.0" encoding="utf-8"?>

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

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:orientation="vertical">


        <android.support.design.widget.CoordinatorLayout android:id="@+id/coordinatorLayout"
                                                         xmlns:android="http://schemas.android.com/apk/res/android"
                                                         xmlns:app="http://schemas.android.com/apk/res-auto"
                                                         android:layout_width="fill_parent"
                                                         android:layout_height="fill_parent">


            <FrameLayout
                android:id="@+id/containerView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
            </FrameLayout>

            <android.support.design.widget.AppBarLayout

                android:id="@+id/appBarLayout"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="fill_parent"
                    android:layout_height="?attr/actionBarSize"
                    android:background="?attr/colorPrimary"
                    android:title="Android Testing"
                    app:layout_scrollFlags="scroll|enterAlways"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
                <!-- Tab Layout for creating tabs -->
                <android.support.design.widget.TabLayout
                    android:id="@+id/tabs"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/material_blue_grey_800"
                    app:tabGravity="fill"
                    app:tabIndicatorColor="@color/main_color"
                    app:tabMode="fixed"
                    app:tabSelectedTextColor="@color/main_color"
                    app:tabTextColor="@color/white">

                </android.support.design.widget.TabLayout>
                <!-- Helps handing the Fragments for each Tab -->
            </android.support.design.widget.AppBarLayout>

            <android.support.v4.view.ViewPager
                android:id="@+id/viewPager"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

        </android.support.design.widget.CoordinatorLayout>

    </LinearLayout>


    <android.support.design.widget.NavigationView
        android:id="@+id/shitstuff"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:layout_marginTop="-24dp"
        app:itemTextColor="@color/black"
        app:menu="@menu/drawermenu"/>

</android.support.v4.widget.DrawerLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawerLayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <android.support.design.widget.CoordinatorLayout
          android:id="@+id/coordinatorLayout"                                                  
          android:layout_width="fill_parent"
          android:layout_height="fill_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appBarLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="fill_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                android:title="Android Testing"
                app:layout_scrollFlags="scroll|enterAlways"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
            <!-- Tab Layout for creating tabs -->
            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/material_blue_grey_800"
                app:tabGravity="fill"
                app:tabIndicatorColor="@color/main_color"
                app:tabMode="fixed"
                app:tabSelectedTextColor="@color/main_color"
                app:tabTextColor="@color/white">

            </android.support.design.widget.TabLayout>
            <!-- Helps handing the Fragments for each Tab -->
        </android.support.design.widget.AppBarLayout>
        <FrameLayout
            android:id="@+id/containerView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
        </FrameLayout><!-- need attention -->

        <android.support.v4.view.ViewPager
            android:id="@+id/viewPager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"/>         <!-- need attention -->

    </android.support.design.widget.CoordinatorLayout>

</LinearLayout>


<android.support.design.widget.NavigationView
    android:id="@+id/shitstuff"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:layout_marginTop="-24dp"
    app:itemTextColor="@color/black"
    app:menu="@menu/drawermenu"/>

</android.support.v4.widget.DrawerLayout>

试试这个:

    <?xml version="1.0" encoding="utf-8"?>

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

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:orientation="vertical">


        <android.support.design.widget.CoordinatorLayout android:id="@+id/coordinatorLayout"
                                                         xmlns:android="http://schemas.android.com/apk/res/android"
                                                         xmlns:app="http://schemas.android.com/apk/res-auto"
                                                         android:layout_width="fill_parent"
                                                         android:layout_height="fill_parent">


            <FrameLayout
                android:id="@+id/containerView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
            </FrameLayout>

            <android.support.design.widget.AppBarLayout

                android:id="@+id/appBarLayout"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="fill_parent"
                    android:layout_height="?attr/actionBarSize"
                    android:background="?attr/colorPrimary"
                    android:title="Android Testing"
                    app:layout_scrollFlags="scroll|enterAlways"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
                <!-- Tab Layout for creating tabs -->
                <android.support.design.widget.TabLayout
                    android:id="@+id/tabs"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/material_blue_grey_800"
                    app:tabGravity="fill"
                    app:tabIndicatorColor="@color/main_color"
                    app:tabMode="fixed"
                    app:tabSelectedTextColor="@color/main_color"
                    app:tabTextColor="@color/white">

                </android.support.design.widget.TabLayout>
                <!-- Helps handing the Fragments for each Tab -->
            </android.support.design.widget.AppBarLayout>

            <android.support.v4.view.ViewPager
                android:id="@+id/viewPager"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

        </android.support.design.widget.CoordinatorLayout>

    </LinearLayout>


    <android.support.design.widget.NavigationView
        android:id="@+id/shitstuff"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:layout_marginTop="-24dp"
        app:itemTextColor="@color/black"
        app:menu="@menu/drawermenu"/>

</android.support.v4.widget.DrawerLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawerLayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <android.support.design.widget.CoordinatorLayout
          android:id="@+id/coordinatorLayout"                                                  
          android:layout_width="fill_parent"
          android:layout_height="fill_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appBarLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="fill_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                android:title="Android Testing"
                app:layout_scrollFlags="scroll|enterAlways"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
            <!-- Tab Layout for creating tabs -->
            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/material_blue_grey_800"
                app:tabGravity="fill"
                app:tabIndicatorColor="@color/main_color"
                app:tabMode="fixed"
                app:tabSelectedTextColor="@color/main_color"
                app:tabTextColor="@color/white">

            </android.support.design.widget.TabLayout>
            <!-- Helps handing the Fragments for each Tab -->
        </android.support.design.widget.AppBarLayout>
        <FrameLayout
            android:id="@+id/containerView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
        </FrameLayout><!-- need attention -->

        <android.support.v4.view.ViewPager
            android:id="@+id/viewPager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"/>         <!-- need attention -->

    </android.support.design.widget.CoordinatorLayout>

</LinearLayout>


<android.support.design.widget.NavigationView
    android:id="@+id/shitstuff"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:layout_marginTop="-24dp"
    app:itemTextColor="@color/black"
    app:menu="@menu/drawermenu"/>

</android.support.v4.widget.DrawerLayout>

谢谢你的朋友!正如我所料,印度人在编程方面是最好的@侯赛因