Before loading,The font of the status bar of the normal page is displayed
After loading 'Why is the font in the status bar invisible?'
The project theme background is white, the status bar is transparent, and the words in the status bar of the loading page using DialogFragment are not visible. How to solve this?
My expectation is that only the middle loading box appears, the words on the status bar are displayed normally, and the entire DialogFragment is completely transparent; thank you
class LoadingDialog(var message: String? = null) : DialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View {
val binding = LoadingViewBinding.inflate(inflater, container, false)
val tvContent = binding.loadingViewTvContent
if (!message.isNullOrEmpty()) {
tvContent.text = message
}
dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
dialog?.window?.setDimAmount(0f) //完全透明
return binding.root
}
override fun onStart() {
super.onStart()
isCancelable = false //点击外部不可取消
val dm = DisplayMetrics()
this.activity?.windowManager?.defaultDisplay?.getMetrics(dm)
this.dialog?.window?.setLayout(dm.widthPixels, dm.heightPixels)
} }