1

大家好,我有问题NavigationBarView。我NavigationBarView在没有刷卡的情况下设置了这个,我在上面设置了其他视图NavigationBarView。我Activity用 Tranculents Style 制作了这个。但我有错误,通知栏是双的,这个画在顶部NavigationBarView

这是我的 XML:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.ad.sample.ui.activity.HomeActivity">
    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">
    </fragment>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <View
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/btn_main_menu"
            android:layout_alignBottom="@+id/navigation_view"
            android:background="@color/biru"
            android:layout_alignParentTop="true"
            android:clickable="true"
            android:soundEffectsEnabled="false" />

        <android.support.design.widget.NavigationView
            android:paddingLeft="8dp"
            android:id="@+id/navigation_view"
            android:layout_below="@+id/btn_main_menu"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/biru"
            app:itemTextColor="@color/white"
            app:menu="@menu/main_menu" />
        <android.support.design.widget.FloatingActionButton
            android:id="@+id/btn_main_menu"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="@dimen/marginTopToolbar"
            app:backgroundTint="@color/white"
            app:elevation="1dp" />
    </RelativeLayout>
</FrameLayout>

还有这个 Style-v21

<style name="AppTheme.HomeActivity">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:windowTranslucentStatus">true</item>
    </style>

如何解决?

在此处输入图像描述

4

1 回答 1

0

试试这个:-您的代码在我的情况下运行良好,看起来双通知栏的问题是由于其他原因造成的。但我已经纠正了你的代码。

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.ad.sample.ui.activity.HomeActivity">
    <fragment
       android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">
    </fragment>

    <RelativeLayout

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >
        <View
            android:layout_width="wrap_content"
            android:layout_height="1dp"
            android:layout_above="@+id/btn_main_menu"
            android:background="@color/blue"
            android:clickable="true"
            android:soundEffectsEnabled="false" />

        <android.support.design.widget.NavigationView
            android:paddingLeft="8dp"
            android:id="@+id/navigation_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/blue"
            app:itemTextColor="@color/white"
            app:menu="@menu/main_menu"
            android:layout_alignParentBottom="true"
            />
        <android.support.design.widget.FloatingActionButton
            android:id="@+id/btn_main_menu"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            app:backgroundTint="@color/white"
            app:elevation="1dp"
            android:layout_above="@+id/navigation_view"/>
    </RelativeLayout>
</FrameLayout>
于 2016-12-22T11:02:57.327 回答