WebView after closing fullscreen view, webview auto scrolls to top

早过忘川 提交于 2020-03-26 04:03:07

问题


I have webveiw (with fullscreen support) on the fragment. The issue is when i close fullscreen the webview scrolls it position to top. Noticed:

  • the issue appears only if apply FLAG_FULLSCREEN flag (but i need to apply it to have real fullscreen)
  • found possible solution is to use java script, but there is no answer. Also i'm not found the way to resolve this with webview functions like scrollTo and ect
  • when i add (instesad of fullscreen-view) view with small size (100dp height) i see that webview content is gone. Is it cached somwhere? Is it possible to disable this?

回答1:


For me the issue was that webview have match_perent or wrap_content in height and after applying FLAG_FULLSCREEN webview lose it height. solution was to set layoutParams.height = height before set FLAG_FULLSCREEN

so, in this case "layoutParams.height" - layout height settings, "height" - current view height



来源:https://stackoverflow.com/questions/60473138/webview-after-closing-fullscreen-view-webview-auto-scrolls-to-top

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!