android webview client activity indicator

前端 未结 4 1714
粉色の甜心
粉色の甜心 2020-12-31 09:57

I got the code for showing activity indicator in a webview. I checked more than one reference and still I couldn\'t get it working. Can you please help me to debug my code b

4条回答
  •  天涯浪人
    2020-12-31 10:49

    Kotlin snipet:

    myProgressBar.show()
    
    myWebView.webViewClient = object : WebViewClient() {
        override fun onPageFinished(view: WebView, url: String) {
            myProgressBar.hide()
        }
    }
    

    Add this extension functions to your extensions file:

    fun View.show() {
        visibility = View.VISIBLE
    }
    
    fun View.hide() {
        visibility = View.GONE
    }
    

提交回复
热议问题