开发者

how to disable webview for a while in android

Assume i have 10 web page. First time im loading 1st page and the next page will be loaded when user swipes the screen.so i incrementing web page count when the user swipes the screen. but problem is while loading a page if user swipes the screen many times then web view loades the page that is incremented by the unne开发者_JAVA百科cessary swipe done by the user while loading.. So i want to disable the user to touch the webview screen while page loading . how can i do that?


What I get from your description is that if user swipe from Page 1 to Page 2 and the page is loading in the mean time if user swipe 3 times then it will load Page 2,3,4,5 and you want disable swipe at unless Page 2 has been loaded. If I am correct then below is my solution

In onfling() method check for boolean that whether the page is completely loaded or not if not then return without further processing and I suppose your code for downloading the code will not run. This boolean must be set false before you call the downloading method and set to true where the downloading is finished.

Apart from this I will suggest to load that particular page on which the user finally scrolls to rather than disabling the swipe for that you will have to do nothing onFling just check whether the downloader thread is alive for the last page or not if yes interrupt it and start it again for the current page I think this approach is more user friendly

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜