Skip to content
This repository has been archived by the owner on Sep 30, 2023. It is now read-only.

Navigation Bar Transparency

Sergej Shafarenka edited this page Apr 25, 2020 · 5 revisions

Although transparent navigation bar can be configured starting from API level v23, such a configuration can cause contrast issues to the navigation icons on devices with white navigation icons (see this issue), while look absolutely good on other devices with gray navigation icons like on HUAWEI devices. Fully transparent navigation bar is safe to use starting from API level v29.

Thus applying full, partial or no transparency for [v23..v29) devices is your decision and responsibility as a developer. The library doesn't enforce it by any means.

You can apply navigation bar colors in your project as following:

  1. res/values/colors.xml (black by default)
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="navigationBar">#000000</color>
    ...
</resources>
  1. res/values-v23/colors.xml, color or your choice for API [v23..v29)
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="navigationBar">color value of your choice</color>
    ...
</resources>

Safest color value is @android:color/black, other possible values are #5f000000 (semi-transparent), @android:color/transparent. You might also want to make navigation bar transparent for night theme and keep it opaque black for daylight theme, which would keep good icons contrast on majority of devices.

  1. res/values-v29/colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="navigationBar">@android:color/transparent</color>
    ...
</resources>
Clone this wiki locally