gpt4 book ai didi

安卓 WebView : How setOffscreenPreRaster() works?

转载 作者:行者123 更新时间:2023-11-30 00:25:20 26 4
gpt4 key购买 nike

我正在学习 Android WebView。在阅读 WebSettings 文档时,我遇到了这个方法:setOffscreenPreRaster()。文档说:设置此 WebView 在屏幕外但附加到窗口时是否应光栅化图 block 。

光栅图 block 是什么意思?在什么情况下我应该在我的 WebView 中使用这个方法?

最佳答案

official documentation说:

Sets whether this WebView should raster tiles when it is offscreen but attached to a window. Turning this on can avoid rendering artifacts when animating an offscreen WebView on-screen. Offscreen WebViews in this mode use more memory. The default value is false. Please follow these guidelines to limit memory usage:

  • WebView size should be not be larger than the device screen size.
  • Limit use of this mode to a small number of WebViews. Use it for visible WebViews and WebViews about to be animated to visible.

this 中找到更多信息主题:

On android M (6.0), you can try setOffscreenPreRaster. This essentially redefines the visible viewport to the webview rect, and ignores completely where webview is in relation to the screen. So the correct way to use this would be to set it on a webview if it's about to become visible, to minimize the downside that the webview would use more memory while in background.

关于安卓 WebView : How setOffscreenPreRaster() works?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45478069/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com