我遇到了一个以前从未发生过的问题,看起来真的是史无前例的,有些文字并没有包含在div中.
在这个链接中是我的HTML代码示例:
<div id="calendar_container">
<div id="events_container">
<div class="event_block">
<div class="title">
lorem ipsum lorem ipsumlorem ipsumlorem ipsumlorem
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
任何帮助?
尽管经过多次尝试,但我无法得到我想看到的结果 - 文本居中在JLabel中,而JLabel在BorderLayout中居中.我说"有点",因为窗口的右下角应该还有另一个标签"status".这里有一些代码负责:
setLayout(new BorderLayout());
JPanel area = new JPanel();
JLabel text = new JLabel(
"<html>In early March, the city of Topeka," +
" Kansas,<br>temporarily changed its name to Google..." +
"<br><br>...in an attempt to capture a spot<br>" +
"in Google's new broadband/fiber-optics project." +
"<br><br><br>source: http://en.wikipedia.org/wiki/Google_server" +
"#Oil_Tanker_Data_Center</html>", SwingConstants.CENTER);
text.setVerticalAlignment(SwingConstants.CENTER);
JLabel status = new JLabel("status", SwingConstants.SOUTH_EAST);
status.setVerticalAlignment(SwingConstants.CENTER);
Font font = new Font("SansSerif", Font.BOLD, 30);
text.setFont(font);
area.setBackground(Color.darkGray);
text.setForeground(Color.green);
// text.setAlignmentX(CENTER_ALIGNMENT);
// text.setAlignmentY(CENTER_ALIGNMENT);
// text.setHorizontalAlignment(JLabel.CENTER);
// text.setVerticalAlignment(JLabel.CENTER);
Font font2 = new …Run Code Online (Sandbox Code Playgroud) 我需要转换的HTML文本,以纯文本字符串的形式.
String mHtmlString = "<p class="MsoNormal" style="margin-bottom:10.5pt;text-align:justify;line-height: 10.5pt"><b><span style="font-size: 8.5pt; font-family: Arial, sans-serif;">Lorem Ipsum</span></b><span style="font-size: 8.5pt; font-family: Arial, sans-serif;">&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining …Run Code Online (Sandbox Code Playgroud) 所以我有一个MovieClip资产,里面有一个动态文本字段.我将.fla导出为.swc以在Flash Builder 4中使用,并使用代码创建资产实例,从XML动态填充文本.
我的问题是,即使我启用了htmlText,粗体和斜体标签似乎也不起作用.我有一种感觉,因为当我在Flash CS4中创建资源时,文本字段会让您指定字体以及要使用的子集(常规,粗体,倾斜等).
有没有办法让htmlText正确渲染粗体和斜体标签,而不必完全重新思考我创建所有这些字段的方式?
图像可以TextArea使用htmlText属性包含在控件中:
ta.htmlText = '<img src="http://..."/>';
Run Code Online (Sandbox Code Playgroud)
如何参考嵌入图像?
一个例子:
<mx:TextArea xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Embed(source='../assets/img.gif')]
public var img:Class;
]]>
</mx:Script>
<mx:htmlText>
<![CDATA[
<img src="???" />
]]>
</mx:htmlText>
</mx:TextArea>
Run Code Online (Sandbox Code Playgroud)
UPD:
<img src='../assets/img.gif />
Run Code Online (Sandbox Code Playgroud)
适用于本地计算机,但在服务器环境中它会抛出:
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
我怎样才能解决这个问题?
有没有办法从TextArea组件的htmlText属性中定义的锚调用动作脚本函数.
谢谢
根据此网页,如果使用span标记,TextArea中的htmlText属性可以处理CSS文本样式.我想在我的代码中格式化多个标签.就像是:
var tags:TextArea = new TextArea();
tags.htmlText = "<span style='color: rgb(165, 150, -90);
font-size: 0.955882610016677em'>street</span>,
<span style='color: rgb(168, 143, -59); font-size: 0.98076913067067em'>
motor</span>";
Run Code Online (Sandbox Code Playgroud)
它只给我纯文本.我想知道htmlText属性是否支持它,我该如何解决这个问题.有任何想法吗?谢谢!