protected void setupToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayHomeAsUpEnabled(true); } // Status bar if (Build.VERSION.SDK_INT >= 21) { getWindow().setStatusBarColor(Color.parseColor(mColors[GridActivity.DARK_PRIMARY])); } // Entire bar layout int barColor = Color.parseColor(mColors[GridActivity.PRIMARY]); AppBarLayout barLayout = (AppBarLayout) this.findViewById(R.id.app_bar); if (barLayout != null) { barLayout.setBackgroundColor(barColor); } toolbar.setBackgroundColor(barColor); CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout) this.findViewById(R.id.toolbar_layout); if (collapsingToolbarLayout != null) { collapsingToolbarLayout.setBackgroundColor(barColor); collapsingToolbarLayout.setContentScrimColor(barColor); } }