I am using the following layout (main_activity.xml)
Add these two lines in the onCreate of the activity that you want its layout status bar to be transparent
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
No need to change your app theme or xml layout. In doing this your bar doesn't have to be transparent throughout your whole app if you don't want to.