The nougat status bar for Android displays white at startup

In my Android app, I have a MainActivity function. M. This activity uses the Android tabLayout widget to initialize four tabs. Each tab corresponds to one fragment, say, F1, F2, F3, F4 - four fragments.

From F2, I run an action, say C. But while C starts, the status bar on my device flickers for a moment. By flickering, I mean, initially its dark (black) colors. then it gradually fades to white and becomes dark again. Now C starts up. When I try to exit C, go back to F2 (by pressing the navigation button back) the same effect is displayed again, but this time it gets worse. I mean, the status bar stays a bit white. Then it returns to a dark color.

I observe this problem only on android nougat. In previous versions of his wokring.

So far I have tried How can I prevent the status bar and navigation bar from appearing during the transition of an activity scene animation?

The above link has two approaches: Appraoch 1. This did not work for me. Approach 2. My application crashes because findViewById(android.R.id.statusBarBackground); returns null.

Please suggest how I can solve this problem.

+6
source share
1 answer

Add <item name="android:windowIsTranslucent">true</item> In your activity topic value-v21/syles.xml .
Since android: windowIsTranslucent will be displayed on the My Phone status bar (Api = 19) for a moment. And make the activity animation not work.
This way you can create value-v21 and add code to styles.xml.

0
source

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


All Articles