Control panel color not set correctly on Meizu PRO 6

I have a problem with specific devices with Meizu PRO 6 / android 6.0

I am trying to set the color colorPrimaryDarkin the theme file

When I set it to #FF0000(red), it works greatMeizu PRO 6 / # FF0000

But when I set it to #000000(black), it doesn’t apply (as you see, the color is the same as colorPrimary)Meizu PRO 6 / # 000000

The same code works on the LG Nexus 5x: Nexus 5x / # 000000

What could go wrong here? And how can this be fixed?

Suppose the current device has some color filtering for the statusBar, maybe it only allows colors that are lighter than colorPrimaryor something like this ...

+5
source share
2 answers

The problem is that Meizu has a custom launcher and its implementation.

For me

getWindow().setStatusBarColor(color);
actionBar.setBackgroundDrawable(new ColorDrawable(color));

works fine. But when I tried to use it in an activity that was not yet focused, it did not work.

But this workaround (see snippet below) works. Just refresh colors when your activity has focus.

 @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (hasFocus) {
          //... your code for colorization
        }
 }
0
source

I ran into the same problem with navigationBarColoron the OnePlus A6000 (6) / Android 9.
So, I just used the “almost” black color: #010101and it works well! I believe that some phone manufacturers use #000(this is 0) as the default, which tells the system to use the main color of the application.

0
source

Source: https://habr.com/ru/post/1660153/


All Articles