Android Web page: day02html and CSS Combat WebView implementation of mobile phone display

Source: Internet
Author: User

Day02 Html, CSS Combat and webview implementation of mobile phone display page 1.html and CSS Combat 1.1 program Ape Small page
  • Let's take a look.

  • The diagram for programming is as follows

  • The implementation code is as follows

    <!        DOCTYPE html>
1.2 Renren Registration Page
    • Let's take a look.

    • The diagram for programming is as follows


  • The implementation code is as follows

    <! DOCTYPE html>
1.3 7881 Home
    • Let's take a look.

  • The implementation code is as follows


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.