1. Set WebView to Transparent:
Webview.loaddatawithbaseurl (null, "
3. WebView Display string:
Webview.loaddatawithbaseurl ("fake://not/needed", S1, "text/html", "Utf-8", "" ");
4. Set the size of the font shown in WebView:
Public static final textsize[] font_sizes = new textsize[]{textsize.smaller ,textsize.normal,textsize.larger}; private websettings wb; wb = mwebviewrightcontent.getsettings (); Wb.settextsize (Font_sizes[ifontsizeid]); /* Font size:*/public enum textsize { smallest (), smaller ( normal),, larger ( largest),; textsize (int size) { value = size; } int value; } 5, WebView display the HTML file, to achieve the same effect as the browser displayed on the PC, just set the WebView:
View plaincopy//fit full Screen 39 fit vertical Screen 57 adapt to horizontal screen mwebview.setinitialscale (39); Note: HTML fonts are too small to display on the Android phone or on the development Board is quite small. General 6, 7th font bar!
6. WebView Set the gradient:
Android:fadingedge= "vertical" android:fadingedgelength= "20px"//(vertical, up and down gradient area is 20px)
7. Set WebView to zoom in and out of touch:
Mwebview.getsettings (). Setbuiltinzoomcontrols (True);
8, WebView Double-click to become larger, and then double-click to become small, when manually enlarged, double-click can revert to the original size, the following settings:
Webview.getsettings (). Setusewideviewport (True);
9. Several methods of accelerating webview loading:
//· Increase the priority of rendering webview.getsettings (). setrenderpriority (Renderpriority.high);// Using Webview.getsettings (). Setblocknetworkimage, load the picture at the end to load the render webview.getsettings (). Setblocknetworkimage (True);
10. Convert string to HTML file display:
Gets the string string sdetails = cursor.getstring (Cursor.getColumnIndex ( "Schinese")); //intercepts the string by line, storing it in an array string[] str = sdetails.split ("\ n"); string s1 = ""; //iterates through the array and, if the condition is true, adds the set CSS style for (int i = 0;i < str.length;i ++) { if () {Str[i].trim (). StartsWith ("Vt.")) { str[i] = " Android WebView Related properties