TrinityTuts Tips

Change Android navigation bar color programatically

In this tutorial, I am going to show you how we can change the Android Navigation bar color programmatically or Android button bar color. Here is simply one line code to do this but we need to add a check for Android version this code work on 21 and greater.

 

 

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
   getWindow().setNavigationBarColor(getResources().getColor(R.color.theme_c5));
}

Hope this code helps you.