Day02 Html, CSS Combat and webview implementation of mobile phone display page 1.html and CSS Combat 1.1 program Ape Small page
1.2 Renren Registration Page
1.3 7881 Home
2. WebView implementation of mobile phone display page
- Purpose: To display 7881 pages in an Android phone using the WebView control
Steps:
- First put the good 7881 pages into the Tomcat server, to ensure that the browser can access to 7881 pages
- Build Android Application project, edit layout file, write a WebView control
- In Mainactivity, get the control object WebView in the layout file and use the Loadurl () method to access the 7881 address in the browser as a parameter and set access to network permissions
- Run the Android project to display the page
The main code is as follows
The Activity_main.xml code is as follows
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity" ><WebView android:id="@+id/wv" android:layout_height="wrap_content" android:layout_width="wrap_content"/></LinearLayout>
The Mainactivity.java code is as follows
package com.itheima.exam;import android.app.Activity;import android.os.Bundle;import android.webkit.WebView;public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView wv = (WebView)findViewById(R.id.wv); wv.loadUrl("http://192.168.18.25:8080/7881.html"); } }
Android Web page: day02html and CSS Combat WebView implementation of mobile phone display