How does Android WebView nest Html?

Source: Internet
Author: User

LoadDataWithBaseURL (baseUrl = null/"about: blank ",......), BaseUrl is null or "about: blank" specifies the relative path.
WebView mainly calls three methods: LoadUrl, LoadData, and LoadDataWithBaseURL.
1. LoadUrl directly loads webpages and images and displays them (webpages, images, and gif images on a local or network)
2. LoadData display text and image content (simulator 1.5, 1.6)

3. LoadDataWithBase displays text and image content (multiple simulator versions supported)

Public class AboutView extends Activity implements OnTouchListener, OnClickListener {private Button btnAbout; private WebView aboutBrowser; @ Overrideprotected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. about); btnAbout = (Button) this. findViewById (R. id. about_button); aboutBrowser = (WebView) this. findViewById (R. id. about_webkit); btnAbout. setOnTouchListener (this); btnAbout. setOnClickListener (this); // WebSettings s = aboutBrowser. getSettings (); // s. setUseWideViewPort (true); // s. setJavaScriptEnabled (true); // s. setBlockNetworkImage (true); loadHTML () ;}@ Overridepublic boolean onTouch (View v, MotionEvent event) {return false ;}@ Overridepublic void onClick (View v) {if (v = btnAbout) {// here, the Activity is switched. // Note: every Activity must be in AndroidManifest. register Intent I = new Intent (); I. setClass (AboutView. this, CiHaiView. class); this. startActivity (I); AboutView. this. finish () ;}} public void loadHTML () {String vStr = getText (R. string. vStr ). toString (); String vNum = getText (R. string. vNum ). toString (); final String htmlText = "
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.