繁体   English   中英

为什么打开底页时 System BottomNavigation 的颜色变为黑色?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM