Search code examples
androidstatusbartranslucency

How to make Android Status Bar color match with Action Bar's using SystemBarTint lib?


Using this lib: https://github.com/jgilfelt/SystemBarTint

I learn that it's possible to have a translucent status bar on KitKat, but here's how it looks in Android L Preview on Nexus 5: enter image description here

Is it possible to make the color of status bar match the action bar's?

Here's how I've been using the lib:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
    {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintColor(getResources().getColor(R.color.BrightRed));

        SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
        mDrawerListLayout.setPadding(0, config.getPixelInsetTop(true), config.getPixelInsetRight(), config.getPixelInsetBottom());
    }

Solution

  • You shouldn't use SystemBarTint on L, coloring the status bar is part of Material design. Use the Material theme and set the colors in your theme.