Android ViewPager automatically focuses WebView

I have an Android application with ViewPager from the support library. Inside the snippet, I have some top views and a WebView with some HTML content below.

The first page loads correctly, but when switching between pages, each next page automatically scrolls to web browsing and focuses on it (image, hyperlink), denoting it with the default style (orange on my phone). This is very strange, I don’t know where it came from, and I want to get rid of this behavior. Each page should be on top (scroll position 0) when opening. This happens with a slight delay after viewing the load (onCreateView), so setting the scroll position to 0 in onCreateView did not help.

After going to another page, it should look like this:

good version http://imageshack.us/a/img254/4623/shotgood.png

But after approx. secondly, it automatically scrolls down, focuses the link and looks like this:

bad version http://imageshack.us/a/img855/1848/shotbad.png

Has anyone experienced such a problem and know a solution?

Thanks in advance.

EDIT: I noticed that this problem does not occur until I scroll vertically inside any fragment. After I scroll vertically and then go to another page, this starts to happen on every next page.

+4
source share
1 answer

After several days of searching, I finally found the solution described here:

Web View Inside Android Pager

dot adds

android:descendantFocusability="blocksDescendants". 

for the outermost linear layout.

+15
source

All Articles