Android webview div style="height: auto"显示黑屏

发布于 2024-11-27 09:58:57 字数 245 浏览 4 评论 0 原文

我正在使用 webview 在 android 应用程序中显示 html 页面。我在滚动时遇到困难,因此使用了滚动视图并将 div 的高度设置为 auto style=”height:auto;”。完美解决了滚动问题。

但是,这导致了另一个问题,因为 div 的高度设置为 auto,如果 div 为 200px,则标签后面不会出现任何内容。这意味着只要 div 小于屏幕的高度,屏幕的其余部分就是黑色的。有什么办法可以将屏幕空白部分的背景设置为白色吗?谢谢。

I am using webview to display html pages in an android application. I was having difficulty with scrolling so used scrollview and set the height of the div to auto style=”height:auto;”. That solved the scrolling issue perfectly.

However, this led to another issue that because the height of the div is set to auto, if the div is say 200px, then nothing appears after the tag. This means that whenever the div is less than the height of the screen the remainder of the screen is black. Is there any way to set the background of the empty part of the screen to white instead? Thanks.

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

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

发布评论

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

评论(1

请帮我爱他 2024-12-04 09:58:57

我回来了,我终于找到了一个解决方案 - 通常,它很简单,但希望其他人可以从中受益。

基本上我所要做的就是在 main.xml 文件中将背景从黑色更改为白色,如下

android:background="#ffffff"

就是这样!

I am back and i finally found a solution - typically, it was simple but hopefully someone else can benefit from it.

basically all I had to do was in the main.xml file change the background from black to white as follows

android:background="#ffffff"

and that was that!

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