我使用以下方法設定了系統底部導航的背景顏色:
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();
底頁關閉時的底部導航:

打開底頁時的底部導航:

有人可以幫忙嗎?
uj5u.com熱心網友回復:
所以最后我得到了答案。
我們需要寫:
<item name="android:navigationBarColor" tools:targetApi="21">@color/navcolor</item>
在themes.xml檔案中
它將改變系統底部導航的背景顏色。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/497831.html
