Search code examples
androidandroid-5.0-lollipop

Default Alpha value of navigation bar in Lollipop


If you set android:windowTranslucentNavigation to true in your theme in Lollipop the navigation bar won't be fully translucent like in KitKat. Instead it's a dark semi-transparant background. Does anyone here know what the alpha value is of that background?


Solution

  • I've made some test with navigation bar and found that alpha of navBar when android:windowTranslucentNavigation = true is 40% of black color.

    So color in hex would be: #66000000

    Here is steps how I calculated this value:

    1. I made screenshot as presented below
    2. Then I open it in Gimp image editor and take RGB values of each color
    3. White is (255,255,255), white under navBar (153,153,153)
    4. Grey is (150,150,150), grey under navBar (90,90,90)

    Then I calculate as next: 255 is 100% 153 is x x = 153 * 100 / 255 = 60%

    So I calculated invert value of alpha channel, the true value of alpha channel is 100 - 60 = 40%

    ARGB value of 40% is (102,0,0,0) in hex it's #66000000

    enter image description here