简体   繁体   English

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

[英]Android webview div style=“height: auto” displays black screen

I am using webview to display html pages in an android application. 我正在使用webview在android应用程序中显示html页面。 I was having difficulty with scrolling so used scrollview and set the height of the div to auto style=”height:auto;”. 我在滚动时遇到了困难,因此使用了scrollview并将div的高度设置为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. 但是,这导致了另一个问题,因为div的高度设置为auto,因此如果div表示200px,则标记后没有任何内容。 This means that whenever the div is less than the height of the screen the remainder of the screen is black. 这意味着,每当div小于屏幕高度时,屏幕的其余部分均为黑色。 Is there any way to set the background of the empty part of the screen to white instead? 有什么方法可以将屏幕空白部分的背景设置为白色吗? Thanks. 谢谢。

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 基本上我要做的就是在main.xml文件中,将背景从黑色更改为白色,如下所示

android:background="#ffffff" android:background =“#ffffff”

and that was that! 就是这样!

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

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