
[英]Android - Chip background color changes when used with BottomSheet Material 3
[英]Why the color of System BottomNavigation changes to black when i open bottomsheet?
我使用以下方法设置了系统底部导航的背景颜色:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
getWindow().setNavigationBarColor(getResources().getColor(R.color.navcolor));
}
哪个工作正常!
但问题是当我打开自定义底页时,bottomNavigation 的背景颜色变为黑色。
显示底页的代码:
BottomSheetDialog dialog = new BottomSheetDialog(MainActivity.this);
dialog.setContentView(R.layout.sortfilterbottomsheet);
dialog.setCanceledOnTouchOutside(true);
dialog.show();
有人可以帮忙吗?
所以最后我得到了答案。
我们需要写:
<item name="android:navigationBarColor" tools:targetApi="21">@color/navcolor</item>
在themes.xml文件中
它将改变系统底部导航的背景颜色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.