I. Common WebView Methods
Method |
Function |
GetSettings () |
Returns a WebSettings object to control WebView attribute settings. |
LoadData (String data, String mimeType, String encoding) |
Load the specified Data to the WebView and use "data:" As the tag header. This method cannot load network data. Here, mimeType is the data type, such as text/html and image/jpeg. Encoding is a character encoding method. |
LoadUrl (String url) |
Load the specified url |
SetWebViewClient (WebViewClient client) |
Specify a WebViewClient object for WebView. WebViewClient can assist WebView in handling various notifications, requests, and other events. WebViewClient provides some methods. |
SetWebChromeClient (WebChromeClient client) |
Specify a WebChromeClient object for WebView. WebChromeClient is used to assist WebView in processing JavaScript dialogs, website titles, website icons, loading progress, and so on. |
Ii. Common WebSettings Methods
Method |
Function |
SetAllowFileAccess (boolean allow) |
Set whether to allow access to file data |
SetBlockNetworkImage (boolean flag) |
Sets whether to disable image display. true disables image display. |
SetDatabaseEnabled (boolean flag) |
Set whether data-related APIs can be used |
SetDatabasePath (String databasePath) |
If you can use the database API, this method specifies the path of the database file |
SetDefaultFontSize (int size) |
Set default font size |
SetDefaultTextEncodingName (String encoding) |
Sets the default character encoding mode. |
SetJavaScriptEnabled (boolean flag) |
Set whether JavaScript is supported |
SetSavePassword (boolean save) |
Set whether to store Password |
Setsuppzoom zoom (boolean support) |
Set whether Zoom is supported |
SetTextSize (WebSettings. TextSize) |
Set the page text size |
Iii. Common WebViewClient Methods
Method |
Function |
DoUpdataVisitedHistory (WebView view, String url, boolean isReload) |
Update history |
OnLoadResource (WebView view, String url) |
Notifies the main program WebView that resources corresponding to the specified address will be loaded. |
OnPageFinished (WebView view, String url) |
Notice that the main program web page has been loaded |
OnPageStarted (WebView view, String url, Bitmap favicon) |
Notify the main program to start loading the webpage |
OnReceivedError (WebView view, int errorCode, String description, String failingUrl) |
Call when an unrecoverable error message is encountered |
OnScaleChanged (WebView view, float oldScale, float newScale) web |
Called when the scaling ratio of WebView changes |
ShouldOverrideKeyEvent (WebView view, KeyEvent event) |
Controls whether WebView processes button events. If true is returned, WebView does not process the events, and vice versa. |
ShouldOverrideUrlLoading (WebView view, String url) |
Control the processing right of the newly loaded Url. True is returned, indicating that the main program is processing and WebView is not processing. If the return value is false, WebView will process it. |
Iv. Common WebChromeClient Methods
Method |
Function |
OnJsAlert (WebView view, String url, String message, JsResult result) |
Processing the Alert dialog box in JavaScript |
OnJsConfirm (WebView view, String url, String message, JsResult result) |
Process Confirm dialog box in JavaScript |
OnJsPrompt (WebView view, String url, String message, String defaultValue, JsPromptResult result) |
Processing the Prompt dialog box in JavaScript |
OnProgressChanged (WebView view, int newProgress) |
Called when the progress bar changes |