mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
1.3 KiB
1.3 KiB
nav-title, title, environment, description, previous_url
| nav-title | title | environment | description | previous_url |
|---|---|---|---|---|
| WebView How-To | web-view | nativescript | Examples for using WebView | /ApiReference/ui/web-view/HOW-TO |
WebView
Using a WebView requires the web-view module. {%snippet webview-require%}
Declaring a WebView.
{%snippet declare-webview-xml%}
Creating a WebView
{%snippet declare-webview%}
Using WebView with remote URL
{%snippet webview-url%}
Using WebView with local file
{%snippet webview-localfile%}
Using WebView with raw HTML
{%snippet webview-string%}
Using WebView with gestures
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
<Page.actionBar>
<ActionBar title="My App" icon="" class="action-bar">
</ActionBar>
</Page.actionBar>
<GridLayout>
<WebView loaded="webViewLoaded" touch="webViewTouch" pan="webViewPan" src="<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>" />
</GridLayout>
</Page>
{%snippet web-view-loaded%}
Note: to be able to use gestures in
WebViewcomponent on Android, we should first disabled the zoom control. To do that we could access theandroidproperty and with the help ofsetDisplayZoomControlsto set this controll tofalse.