Android ProgessBar while loading WebView

后端 未结 12 2572
闹比i
闹比i 2020-12-08 01:52

In my application, I have a WebView which loads any URL from the internet. Now, sometimes due to slow networks the page takes a long time to load and the user s

12条回答
  •  爱一瞬间的悲伤
    2020-12-08 02:48

    You can use something like that:

    override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
        super.onPageStarted(view, url, favicon)
        binding.pbLoader.visibility = ProgressBar.VISIBLE
    }
    
    override fun onPageCommitVisible(view: WebView?, url: String?) {
        super.onPageCommitVisible(view, url)
        binding.pbLoader.visibility = ProgressBar.GONE
    }
    

提交回复
热议问题