2017-06-20 66 views
1

如何在圖像下載時在webview中設置圖像的默認背景顏色。在我目前的狀況我對圖像的CSS是在下載圖像之前在webview中設置圖像的背景顏色android

img { 
    display : block; 
    box-sizing:border-box; 
    background:#eeeeee; 
    margin : auto; 
    margin-top : 24pt; 
    margin-bottom : 24pt; 
    width: inherit; 
    height: inherit; 
} 

但在這種情況下,我的WebView UI不顯示圖像之前的任何空間或背景,一旦圖像被下載我的UI拉伸,以騰出空間圖像並下載圖像,當然後呈現圖像背景和圖像。

如何在下載和渲染圖像之前爲圖像標籤分配空間並設置背景。

喜歡這個網站

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset='UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1'> 
    <link rel="stylesheet" href="roboto.css"><link rel="stylesheet" href="webview.css"> 
    </head> 
    <body> 
    <p>According to a recent tweet from noted tipster Evan Blass (@evleaks) the upcoming Samsung Galaxy Note 8 is internally codenamed "Samsung Gr3at". The number 3 apparently signifies three new features that are coming to the Note 8. 
    </p> 
    <img class="alignnone size-full wp-image-3061" src="https://app.abc.com/wp-content/uploads/2017/06/evleaks-Note-8.jpg" alt="" width="640" height="300" /> 
    <p>Although everything about the upcoming phablet is mere speculation, it is believed that the Note 8 will feature the new Infinity Display, a Snapdragon 836 SoC and a dual camera setup. Samsung is expected to launch the Galaxy Note 8 in August. 
    </p> 
    </body> 
</html> 

所有段落負載即時,但其取出,並在圖像獲取然後UI之前離開圖像不拉伸空間用於顯示圖像。如何在下載之前根據img標籤大小設置圖像空間。

基本上我想知道如何在HTML中設置圖像標記的佔位符。

回答

0

您能給一試:

CSS:

.myDiv { 

    border: 2px gray; 
    display : block; 
    box-sizing:border-box; 
    background:red; 
    margin : auto; 
    margin-top : 24pt; 
    margin-bottom : 24pt; 
    width: 100%; 
    height: inherit; 
} 

HTML:

<body> 
    <p>According to a recent tweet from noted tipster Evan Blass (@evleaks) the upcoming Samsung Galaxy Note 8 is internally codenamed "Samsung Gr3at". The number 3 apparently signifies three new features that are coming to the Note 8. 
    </p> 
    <div class='myDiv'> 
     <img class="alignnone size-full wp-image-3061" src="http://www.jqueryscdript.net/images/Simplest-Responsive-jQuery-Image-Lightbox-Plugin-simple-lightbox.jpg" alt="" width="640" height="300" /> 
    </div> 

    <p>Although everything about the upcoming phablet is mere speculation, it is believed that the Note 8 will feature the new Infinity Display, a Snapdragon 836 SoC and a dual camera setup. Samsung is expected to launch the Galaxy Note 8 in August. 
    </p> 
    </body> 
+0

沒有改變:( – user3528954