onNewPicture() 什么时候被调用?

发布于 2024-10-28 03:41:25 字数 445 浏览 6 评论 0原文

onNewPicture() 的 文档 仅说明:

通知听众该图片 已改变

我的问题是:图片何时发生更改?

我注意到有些网页会生成数十个 onNewPicture() ,因此显然“图片”在 WebView 上渲染页面的过程中发生了多次变化。

什么使 WebView 图片发生变化?

我还没有看到任何页面生成少于 2 个 onNewPicture() 调用,那么对于任何给定的 HTML 页面,onNewPicture() 是否保证被调用多次?

The documentation for onNewPicture() only says:

Notify the listener that the picture
has changed

My question is: When does the picture change?

I noticed that some web pages generate dozens of onNewPicture(), so obviously the "picture" changes many times in the course of rendering the page on a WebView.

What makes a WebView picture change?

I haven't seen any page page that generates less than 2 onNewPicture() calls, so is onNewPicture() guaranteed to be called more than once, for any given HTML page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荒人说梦 2024-11-04 03:41:26

每当已加载的页面完成渲染(或在某些事件使 WebKit 引擎重新计算页面布局时重新渲染)时,都会调用 PictureListener.onNewPicture() 。这实际上取决于正在加载的页面:

一个简单的纯文本页面只会呈现一次。其他页面(尤其是 JavaScript 密集型页面)可以在页面完成加载后被调用多次。

@littleFluffyKitty 的提示位于 另一篇文章:如今,当您在页面上移动时,许多网页都会导致它被频繁调用,因此请确保 onNewPicture() 方法中发生的任何事情都很快。

PictureListener.onNewPicture() is called whenever the already loaded page finished rendering (or re-rendering in case certain events make the WebKit engine re-calculate page layout). It really depends on the page being loaded:

A simple text-only page will be rendered only once. Other pages (especially Javascript-heavy ones) can be called numerous times after the page finished loading.

Tip by @littleFluffyKitty found in another posting: Many webpages today will cause it to get called fairly often as you move around the page so make sure whatever happens in the onNewPicture() method is quick.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文