Android WebView 第一页在销毁后启动时未加载

发布于 2025-01-03 09:55:18 字数 357 浏览 3 评论 0原文

我有一个 WebView,虽然它加载页面需要几秒钟的时间,但我想显示除白屏之外的其他内容,因此我在加载第一页之前加载静态数据

webview.loadDataWithBaseURL("/", wait_html, "text/html", "UTF-8", "");

现在,当我按下后退按钮时,我的活动被破坏,当我重新启动它时,我通常会收到如下警告:

webcore 第一次布局后无法获取 viewWidth

,并且我的静态内容未显示,但之后加载的页面显示没有问题。那么...关于如何让它显示我的静态内容有什么建议吗?

I have a WebView and while it loads the page which takes some seconds I want to show something other than a white screen, so I'm loading static data before loading the first page

webview.loadDataWithBaseURL("/", wait_html, "text/html", "UTF-8", "");

Now, when I press the back button my activity is destroyed and when I restart it, more often than not, I get a warning like:

webcore Can't get the viewWidth after the first layout

and my static content is not displayed but the page that is loaded after is displayed without problems. So... any suggestions on how to make it show my static content?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文