I have set the background color of system bottomNavigation using:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
getWindow().setNavigationBarColor(getResources().getColor(R.color.navcolor));
}
Which is working properly !!!
But the problem is when i open a custom bottomsheet, the background color of bottomNavigation gets changed to black.
Code to show bottomsheet:
BottomSheetDialog dialog = new BottomSheetDialog(MainActivity.this);
dialog.setContentView(R.layout.sortfilterbottomsheet);
dialog.setCanceledOnTouchOutside(true);
dialog.show();
BottomNavigation when bottomsheet is closed:
BottomNavigation when bottomsheet is opened:
Can somebody help ?
CodePudding user response:
So finally I got my answer.
We need to write:
<item name="android:navigationBarColor" tools:targetApi="21">@color/navcolor</item>
in themes.xml file
It will change the background color of system bottom naivgation.