dimanche 14 août 2016

Android WebView: can't make a fullscreen div element

I want to have a div that has exactly the same size as the screen (or viewport) so the code:

<html>
  <body style="width:100%;height:100%;margin:0;background:blue">
    <div style="width:100%;height:100%;background:red"></div>
  </body>
</html>

Simple. It shows a red screen in my desktop chrome browser. Same with the android mobile chrome. But with a WebView in my app, it shows a blue screen. I've tried 50% height and it works well as intended in both of desktop and mobile chrome browser, but not for WebView. The div always has height of 0. Red rectangle is shown only when I set the height of div in an absolute unit like 100px. How can I make it work properly?

Aucun commentaire:

Enregistrer un commentaire