The Goal:
1) Make the status bar transparent - Done
2) Make the BottomNavigationView
and the Navbar
I haven't tested this code but, most probably it should work
if (Build.VERSION.SDK_INT >= 21) {
setWindowFlag(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, false);
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().setNavigationBarColor(Color.TRANSPARENT);
}
The code you have added allows the window to extend outside the actual output area.So. most probably that is allowing your activity to come beneath system widgets that is status bar and nav bar and giving them a transparent look.
Try to remove the code you mentioned from java activity and replace it with mine. I hope it helps.