简体   繁体   English

WebView 关闭全屏视图后,webview 自动滚动到顶部

[英]WebView after closing fullscreen view, webview auto scrolls to top

I have webveiw ( with fullscreen support ) on the fragment.我在片段上有webveiw 支持全屏 The issue is when i close fullscreen the webview scrolls it position to top.问题是当我关闭全屏时,webview 会将其位置滚动到顶部。 Noticed:注意到:

  • the issue appears only if apply FLAG_FULLSCREEN flag (but i need to apply it to have real fullscreen)该问题仅在应用FLAG_FULLSCREEN标志时出现(但我需要应用它才能获得真正的全屏)
  • found possible solution is to use java script, but there is no answer.找到可能的解决方案是使用java脚本,但没有答案。 Also i'm not found the way to resolve this with webview functions like scrollTo and ect此外,我还没有找到使用scrollTo和 ect 等 webview 函数解决此问题的方法
  • when i add (instesad of fullscreen-view) view with small size (100dp height) i see that webview content is gone.当我添加(取代全屏视图)小尺寸(100dp 高度)视图时,我看到 webview 内容消失了。 Is it cached somwhere?它在某处缓存吗? Is it possible to disable this?是否可以禁用此功能?

For me the issue was that webview have match_perent or wrap_content in height and after applying FLAG_FULLSCREEN webview lose it height.对我来说,问题是webview在高度上有match_perent or wrap_content并且在应用FLAG_FULLSCREEN webview 后失去它的高度。 solution was to set layoutParams.height = height before set FLAG_FULLSCREEN解决方案是在设置layoutParams.height = height之前设置FLAG_FULLSCREEN layoutParams.height = height

so, in this case "layoutParams.height" - layout height settings, "height" - current view height因此,在这种情况下,“layoutParams.height” - 布局高度设置,“height” - 当前视图高度

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM