HtmlViewコントロールは、HTMLコンテンツを含むビューを表します。 静的なHTMLコンテンツを表示する場合は、このコンポーネントを使用します。 より高度なシナリオと動的コンテンツには、WebViewを使用してください。
HtmlViewモジュールはtns-core-modules/html-viewからインポートされます。
const HtmlView = require("tns-core-modules/ui/html-view").HtmlView;
import { HtmlView } from "tns-core-modules/ui/html-view";
XMLでHtmlViewを作成します。
<HtmlView html="{{ htmlString }}"></HtmlView>
コードビハインドファイルを介してHtmlView要素を作成します。
const myHtmlView = new HtmlView();
myHtmlView.html = "<span><h1><font color=\"blue\">NativeScript HtmlView</font></h1></br><h3>This component accept simple HTML strings</h3></span>";
const myHtmlView = new HtmlView();
myHtmlView.html = `<span>
<h1><font color=\"blue\">NativeScript HtmlView</font></h1></br>
<h3>This component accept simple HTML strings</h3>
</span>`;
API Reference for theHtmlView Class
Native Component
Android | iOS |
---|---|
android.widget.TextView | UILabel |