Before using WebView, only know that it can be loaded out of the HTML page, it is not known, it can also interact with JS.
WebView is a network view that can load a display page and can be viewed as a browser. It uses the WebKit rendering engine to load the Display Web page
In Andriod, many controls are available in two ways, one is instantiated in a Java file, and one is declared in a layout file
Steps for the first method:
1. Instantiate the WebView component in the activity to: WebView WebView = new WebView (this);
2. Call WebView's Loadurl () method to set the page to display Wevview:
Internet use: Webview.loadurl ("http://www.google.com");
for local files: Webview.loadurl ("file:///android_asset/XX.html"); Local files are stored in the: Assets file
3. Call the activity's Setcontentview () method to display the page view
4. Use WebView point link to see a lot of pages later in order to let WebView support fallback function, need to overwrite the Activity class onkeydown () method, if do not do any processing, click the system fallback shear key, the entire browser will call finish () and end itself, Instead of retreating back to the previous page
5. You need to add permissions to the Androidmanifest.xml file, or the Web page not available error will occur.
<uses-permission android:name= "Android.permission.INTERNET"/>
Steps for the second method:
1. Declare webview in the layout file
2, in the activity of the instantiation of WebView
3, call WebView Loadurl () method, set Wevview to display the page
4. To enable WebView to respond to hyperlinks, call the Setwebviewclient () method to set the WebView view
5, with WebView point link to see a lot of pages later in order to let WebView support fallback function, need to overwrite the Activity class onkeydown () method, if do not do any processing, click the system fallback shear key, the entire browser will call finish () and end itself, Instead of retreating back to the previous page
6. You need to add permissions to the Androidmanifest.xml file, or the Web page not available error occurs.
<uses-permission android:name= "Android.permission.INTERNET"/>
---------------------------------------------------------------------------------------------
And there's the problem of solving webview adaptive screens.
If parsing with an HTML class does not exist this problem, but, WebView can make the text adaptive, the picture is easy to overflow, so that the screen appears horizontal scroll bar
settings.setusewideviewport (true); Settings.setloadwithoverviewmode (true