Android examples for User Interface:StatusBar
set Status Bar Color
//package com.java2s; import android.app.Activity; import android.graphics.Color; import android.os.Build; import android.view.Window; import android.view.WindowManager; public class Main { public static void setStatusBarColor(Activity activity, int statusBarColor) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = activity.getWindow(); if (statusBarColor == Color.BLACK && window.getNavigationBarColor() == Color.BLACK) { window.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); } else { window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); }/*from ww w . ja va 2s .com*/ window.setStatusBarColor(statusBarColor); } } }