导航抽屉位于StatusBar下方

时间:2016-05-11 05:35:47

标签: android navigation-drawer android-support-library

自上次更新支持库以来,导航抽屉出现在状态栏下方。我尽了一切可能的方法来解决这个问题,但无法解决它。

我使用WindowTranslucentStatus解决了它,但我不想使用,因为它使状态栏比primaryDark太暗。

任何帮助都得到高度赞赏! enter image description here

2 个答案:

答案 0 :(得分:0)

<RelativeLayout
    android:id="@+id/fragmentContainer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/aapBar"/>

<!--</RelativeLayout>

<LinearLayout
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <include
        layout="@layout/tool_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <RelativeLayout
        android:id="@+id/fragmentContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/aapBar">

    </RelativeLayout>

</LinearLayout>-->


<android.support.design.widget.NavigationView
    android:id="@+id/navView"
    style="@style/NavigationTheme"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/navigation_header"
    app:menu="@menu/navigation_menu">

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


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

设计支持库版本:'com.android.support:design:23.2.0'

使用它可以正常工作,如果有意义,你可以采取这个剪辑并调整你的布局

答案 1 :(得分:0)

像这样使用ActionbarDrawerToggle

mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
        mDrawerLayout, /* DrawerLayout object */
        R.drawable.ic_drawer, /*
                             * nav drawer icon to replace 'Up' caret
                             */
        R.string.drawer_open, /* "open drawer" description */
        R.string.drawer_close /* "close drawer" description */
        ) {

            /**
             * Called when a drawer has settled in a completely closed state.
             */
            @SuppressLint("NewApi")
            public void onDrawerClosed(View view) {
                super.onDrawerClosed(view);
                getActionBar().setTitle(mTitle);
                getActionBar().setLogo(R.drawable.logo);
            }

            /** Called when a drawer has settled in a completely open state. */
            @SuppressLint("NewApi")
            public void onDrawerOpened(View drawerView) {
                super.onDrawerOpened(drawerView);
                getActionBar().setTitle(mDrawerTitle);

            }
        };