4

Here is how it looks. transparent navigation bar

And here are details. I have activity without background. But it's not an issue. Neither setting background drawable or colour in theme or code fixed an issue.

Activity has soft input mode adjustPan|stateAlwaysHidden

I also set those flags for activity's decor view in code

View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
        | View.SYSTEM_UI_FLAG_FULLSCREEN
        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
        | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY

I tried explicitly set colour to navigation bar in theme like this

<item name="android:navigationBarColor" tools:targetApi="lollipop">@color/chat_bg</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>

But had no success(

I can reproduce it only on my LG Nexus 5X. On other devices I tried navigation bar appears filled with color.

Asimaruk
  • 136
  • 7
  • Since it only appears on one device, you might be looking at a firmware bug. Although the fact that it's a Nexus makes it very unlikely. –  Apr 27 '16 at 19:08
  • I tried Nexus 6P emulator and had same effect. Maybe it all nexus phones. Nexus 7 with android 6 has black nav bar at the bottom. Not transparent. – Asimaruk Apr 27 '16 at 19:18
  • Well, but the Nexus phone have the "correct" implementation, so there must be something wrong with your code, but I'm afraid I cannot help you with that. EDIT: Or maybe it's intended funtionality. Unlikely though. –  Apr 27 '16 at 19:21
  • Even if it is correct I'd like to known how to deal with it. – Asimaruk Apr 27 '16 at 19:53

2 Answers2

0

I had exactly the same problem today. In my case this was because of the theme my Activity was using which was a theme derived from: Theme.AppCompat.NoActionBar. The problem was not in custom theme but apparently the one from AppCompat library. When I changed the parent of my custom style to: @android:style/Theme.NoTitleBar.Fullscreen it started displaying with a solid black background color which is more desired than transparent. I agree this looks like a glitch.

I hope this will help someone in the future as I am aware that this is kind of a late answer.

Adrian Lis
  • 647
  • 4
  • 20
0

I found this solution long ago. Maybe this will help you now

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
}
Asimaruk
  • 136
  • 7