如何更改
BottomSheetDialogFragment
稀松布颜色 - 暗淡的覆盖颜色?
您可以通过
DrawerLayout
为
drawerLayout.setScrimColor(ContextCompat.getColor(this, R.color.dimOverlay))
执行此操作
您可以更改
Window
的背景并设置您想要的透明颜色。
@Override
public @NotNull Dialog onCreateDialog(Bundle savedInstanceState){
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
Window window = dialog.getWindow();
window.setBackgroundDrawableResource(R.color.colorPrimaryTransparent);
return dialog;
}
class AppointmentBottomSheet : BottomSheetDialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view =
inflater.inflate(R.layout.appointment_modal_bottom_sheet_content, container, false)
dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.BLUE)) //--> set any color you want here`enter code here`
return view
}
}