Notification Bar is double drawed on Top Navigation Bar View Android

374 views Asked by At

Hello guys I have problem with NavigationBarView. I set NavigationBarView this without not swipe and I set Other view above NavigationBarView. I made this Activity with Tranculents Style. But I have got error, the notification bar is double, this drawed on top NavigationBarView.

This my 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>

And this 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>

How to fix it?

enter image description here

1

There are 1 answers

0
Nainal On

Try this:- your code is working fine in mine case , looks like the problem of double notification bar is due to some other reason. But i have rectified your code.

<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>