机器人的WebView超时机器人、WebView

2023-09-13 01:03:46 作者:小弟

有没有一种方法来设置的W​​ebView的超时值? 我想要的WebView被timeouted如果URL是太慢了回应。

Is there a way to set the timeout value in WebView? I want the WebView to be timeouted if the url is too slow to response.

推荐答案

您可以做到这一点通过设置一个计时器,检查当前页面的进度通过调用getProgress()而如果它小于经过一段指定时间一些阈值,则可以关闭当前页面的加载。

You can do it by setting up a Timer which checks for progress of current page by calling getProgress() and if it is less than some threshold after some specified time then you can dismiss the loading of the current page.

 
精彩推荐
图片推荐