Webview for Android

Source: Internet
Author: User

Webview can be reused on the android interface. First, write a simple webview implementation.

It is very simple and directly added to the default ADT project. Added a webview to access my blog homepage.

First, remember to add the Internet access permission to androidmanifest. xml; otherwise, the page cannot be accessed.

  1. <Uses-Permission Android: Name = "android. Permission. Internet"> </uses-Permission>

Then, add the layout file:

  1. <Webview Android: Id = "@ + ID/webview" Android: layout_width = "fill_parent"
  2. Android: layout_height = "0dip" Android: layout_weight = "1"/>

Finally, set the attributes of webview in the Code:

  1. This. webview = (webview) This. findviewbyid (R. Id. webview );
  2. This. webview. getsettings (). setsuppzoom zoom (false );
  3. This. webview. getsettings (). setjavascriptcanopenwindowsautomatically (true );
  4. This. webview. loadurl (http://marshal.easymorse.com /);
Related Article

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.