概述
我创建了一个textArea元素,但无法显示我的HTML内容。如果我只显示常规文本,或者如果我将textArea元素更改为RichEditableText元素,它可以正常工作。由于这是针对移动应用程序,我更喜欢使用Adobe推荐的textArea元素。
这是textArea的MXML代码。我得到的只是边框,没有显示任何内容。
Version: 1.0.0.1
任何帮助,将不胜感激。
干杯,
答案
borderAlpha="0" editable="false">
然后写你的html字符串
textrichtml:String = "your html string"
然后使用以下代码。
txt_ar.textFlow = TextConverter.importToFlow(textrichtml,TextConverter.TEXT_FIELD_HTML_FORMAT);
另一答案
在Flex 4.0中,在TextArea中删除了htmlText属性,您可以使用内容属性或TextConverter。
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
import flashx.textLayout.conversion.TextConverter;
]]>
HTML text in a TextArea control. Use the textFlow property of the TextArea control to include basic HTML markup in your text..
]]>
This is HTML text
in an Spark TextArea control.
Use the content property
of the Spark TextArea control
to include basic HTML markup in your text, including
links.
或者在TextArea中使用htmlText属性
[Bindable]
private var _htmlText:String = "This is 14 point blue italic text.This text is 10 point black, italic, and bold.";
]]>
HTML text in a TextArea control. Use the htmlText property of the TextArea control to include basic HTML markup in your text.]]>
editable="false" selectable="false"/>
最后
以上就是单薄芹菜为你收集整理的在textarea里显示html文本,尝试在textarea控件中显示HTML文本(示例代码)的全部内容,希望文章能够帮你解决在textarea里显示html文本,尝试在textarea控件中显示HTML文本(示例代码)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复