css - How to display fullscreen(centerCrop) image on android WebView? -
i load image android webview
, make imageview
's android:scaletype="centercrop"
.
i have tried http://css-tricks.com/perfect-full-page-background-image/. work great on pc's firefox not on android webview. stretch image!! take websetting.setloadwithoverviewmode(false);
account nothing changed.
only css3 method done. because image background not element. however, encounter using html/css3 , webview scale image screen... white screen before image loads . workaround work great on firefox not in android.
do have no choice use imageview
?
please try this:
for portrait mode, , when image height less image width;
_webview.setpadding(0, 0, 0, 0); _webview.setinitialscale((int) (((imageheight-webviewheight)/imageheight)*100)); string html1= new string ("</head> <body style=\"background:url(file:///android_res/drawable/diego.jpg) no-repeat center center\"></body> </html>"); _webview.loaddatawithbaseurl("", html1, "text/html", "utf-8", "");
Comments
Post a Comment