Android Transparent status bar

Recently I wanted to get a transparent status bar so that my app background blends smoothly with the status bar . Below method worked




#Method 1

below snippet in the onCreate() menu help me to make it transparent.
@Overrideprotected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    //make status bar transparent    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
 {
        Window w = getWindow();
        w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        w.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    }



    setContentView(R.layout.activity_main);

}

Comments