首页 > 解决方案 > 如何避免导航视图中出现这种奇怪的状态栏?

问题描述

我试图为两者设置或设置fitSystemWindow为,以及,但它仍然存在..trueflasecoordinator layoutnavigation view

截屏

编辑:这里的代码,奇怪status bar的出现在顶部navigation view

<android.support.v4.widget.DrawerLayout 
    android:id="@+id/drawer_layout"
    android:layout_marginTop="?android:attr/actionBarSize"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:openDrawer="start">

    <include
        android:id="@+id/mainPage"
        layout="@layout/main_page"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:background="@color/colorPrimaryDark"
        app:itemIconTint="@android:color/white"
        app:itemTextColor="@android:color/white"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer"
        android:layout_gravity="start"
        android:paddingTop="10dp"
        android:layout_width="250dp"
        android:layout_height="match_parent"/>
</android.support.v4.widget.DrawerLayout>

标签: c#androidxamarin

解决方案


我看不到其他代码,但有一个类似的演示,它工作正常。链接在这里。你可以参考一下。

主要代码是:

<?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:orientation="vertical"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="#33B86C"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:layout_scrollFlags="scroll|enterAlways" />
 <android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layout"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:layout_width="match_parent">
    <FrameLayout
        android:background="@android:color/holo_purple"
        android:id="@+id/content_frame"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_height="match_parent"
        android:layout_width="200dp"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:menu="@menu/menu" />
</android.support.v4.widget.DrawerLayout>


推荐阅读