简体   繁体   中英

Android Notification Bar Color Changed to White along with the Text

This is a simple layout for tabs. The Android notification panel turns white when I switch to this page. I tried changing the colors and checked the Android notification panel, but it's still white and the text is white too. Its white background + white text, so users can see any notifications.

What might be causing this?

screenshot

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

<RelativeLayout 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=".Tabb">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/primaryDark"
        android:theme="@style/AppTheme.AppBarOverlay"
        android:elevation="3dp">


        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:minHeight="?actionBarSize"
            android:text="Bookings"
            android:layout_marginLeft="20dp"
            android:textColor="@color/white"
            android:elevation="5dp"
            android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" />

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/grey"
            android:elevation="5dp"/>
    </com.google.android.material.appbar.AppBarLayout>

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/view_pager1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="?attr/actionBarSize"
        android:layout_marginTop="?attr/actionBarSize"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:itemBackground="@color/grey"
        app:itemIconTint="@drawable/selector"
        app:menu="@menu/menu_navigation"
        app:labelVisibilityMode="unlabeled"/>
</RelativeLayout>

Check your styling..

There might be an issue with:

android:background="@color/primaryDark"
android:theme="@style/AppTheme.AppBarOverlay"

Add this in your color.xml:

     <color name="colorPrimaryDark">#000000</color> //add your hex code color for notification bar

or use in java

        getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.colorprimarydark));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM