Flex Gumbo 通过textJustify样式设置TextBox文字对齐的例子
作者:
接下来的例子演示了Flex Gumbo中如何通过textJustify样式,设置TextBox文字对齐。
编译本例需要Flex Gumbo build 4285 (4.0.0.4285)版本。
下面是实现代码:
Download: main.mxml
<?xml version="1.0" encoding="utf-8"?>
<Application name="TextBox_textJustify_test"
xmlns="http://ns.adobe.com/mxml/2009"
layout="vertical"
verticalAlign="top"
backgroundColor="white">
<ApplicationControlBar dock="true">
<Form styleName="plain">
<FormItem label="textJustify:">
<ComboBox id="comboBox"
dataProvider="[distribute,interWord]" />
</FormItem>
<FormItem label="width:">
<HSlider id="slider"
minimum="300"
maximum="550"
value="500"
snapInterval="1"
tickInterval="25"
liveDragging="true" />
</FormItem>
</Form>
</ApplicationControlBar>
<Graphic>
<TextBox id="textBox"
textAlign="justify"
textJustify="{comboBox.selectedItem}"
width="{slider.value}">
<text><String source="data/lorem.txt" /></text>
</TextBox>
</Graphic>
</Application>
代码:Peter deHaan 翻译/整理/编译
下面是实现代码:
Download: main.mxml
复制代码 代码如下:
<?xml version="1.0" encoding="utf-8"?>
<Application name="TextBox_textJustify_test"
xmlns="http://ns.adobe.com/mxml/2009"
layout="vertical"
verticalAlign="top"
backgroundColor="white">
<ApplicationControlBar dock="true">
<Form styleName="plain">
<FormItem label="textJustify:">
<ComboBox id="comboBox"
dataProvider="[distribute,interWord]" />
</FormItem>
<FormItem label="width:">
<HSlider id="slider"
minimum="300"
maximum="550"
value="500"
snapInterval="1"
tickInterval="25"
liveDragging="true" />
</FormItem>
</Form>
</ApplicationControlBar>
<Graphic>
<TextBox id="textBox"
textAlign="justify"
textJustify="{comboBox.selectedItem}"
width="{slider.value}">
<text><String source="data/lorem.txt" /></text>
</TextBox>
</Graphic>
</Application>
代码:Peter deHaan 翻译/整理/编译