Synchronizing and combining webviews together to r

2019-08-10 09:03发布

This question is a continuation of "loading long webview over 500kb".

So as the topic suggest it reduces file loading over 500kb long. My idea was to use 5 webviews and merge them together on a UI threading which displays them on the screen. Reason for this is 5 webviews should make it loading seem faster since it only requires to load 20% of the current total data string to be placed in the webview.

Now the problem is actually synchronizing it meaning webview1 when reaching the maximum scrolling index goes to an event handler which goes to webview2 and webview going under the scrolling index would go back to webview1. This applies to all webviews. Could someone direct me to an override event handler that when the scroll goes over the initial 100% of the amount it then gives me the handler.

1条回答
forever°为你锁心
2楼-- · 2019-08-10 09:56

If it is possible the simpler option would be to split the data into separate views, then you could use a AbsListView.OnScrollListener (only available with AbsListView and not WebView) and a list or grid view to present the different views. This seems like a much cleaner way than switching between views but I don't know how you have your layout and perhaps this isn't possible. You would have to arrange your views into a list and then render each view on a back ground thread and push it back into the view when it is ready. You should check out PullToRefresh for a great example on how to do this.

If the above doesn't suite you another option would be use the onTouchEvent to inform you when a user might be scrolling and try calculate using whatever scroll offset methods are available in your Layout/View, when you have hit the bottom but this is very complex. ScrollView has methods to inform you if you have over scrolled which might help

查看更多
登录 后发表回答