HTML page displayed in app

Source: Internet
Author: User
<span id="Label3"></p><p><p>In Today's mobile development, more and more web elements are added to the app, hybrid app can synthesize the advantages of native app and Web app, can realize by WebView</p></p><p><p><br></p></p><p><p>Htmllayout.xml:</p></p><p><p></p></p><pre name="code" class="html"><pre name="code" class="html"><?xml version= "1.0" encoding= "utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android " android:layout_width=" match_parent " android:layout_height=" match_parent " android:o rientation= "vertical" > <webview android:id= "@+id/webview" android:layout_width= "match_parent " android:layout_height=" match_parent "/></linearlayout></pre></pre><br>Webactivity.java<p><p></p></p><p><p><br></p></p><p><p></p></p><pre name="code" class="java">Package Com.kindergartenparent.activity;import Com.kindergartenparent.r;import Android.app.activity;import Android.app.alertdialog;import Android.app.alertdialog.builder;import Android.content.dialoginterface;import Android.content.intent;import Android.os.bundle;import Android.view.view;import Android.view.View.OnClickListener ; Import Android.view.window;import Android.webkit.websettings.layoutalgorithm;import android.webkit.WebView; Import Android.widget.imagebutton;import Android.widget.textview;public class Webactivity extends Activity{private ImageButton back;private TextView title;private WebView wv; @Overrideprotected void onCreate (Bundle Savedinstancestate) {//TODO auto-generated method stubsuper.oncreate (savedinstancestate); requestwindowfeature (window.feature_no_title ); setcontentview (r.layout.htmllayout); init (); Intent Intent = this.getintent (); String url = Intent.getstringextra ("url"); wv.loadurl (url);} public void init () {WV = (WebView) Findviewbyid (r.id.webview);//support javascriptwv.gEtsettings (). setjavascriptenabled (true); The settings can support scaling wv.getsettings (). setsupportzoom (true); The Zoom tool wv.getsettings () is set to Appear. setbuiltinzoomcontrols (true);//scaled scale//wv.getsettings (). setusewideviewport (true); /adaptive screen wv.getsettings (). setlayoutalgorithm (layoutalgorithm.single_column); wv.getsettings (). Setloadwithoverviewmode (true);}}</pre><br><br><p><p></p></p> <p style="font-size:12px;"><p style="font-size:12px;">Copyright Notice: This article for Bo Master original article, without Bo Master permission not Reproduced.</p></p> <p><p>HTML page displayed in app</p></p></span>

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.