竖直方向居中对齐Flex的Text控件中文本
By Minidxer | August 6, 2008
做法其实很简单,将Text装入VBox中,然后在Text周围封装两个Spacer,前后各一个,高度设置为100,搞定~下面是具体的代码:
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
- <mx:VBox verticalAlign="middle" width="300" height="400" backgroundColor="0x000000" borderStyle="solid" borderColor="0x000000" cornerRadius="6">
- <mx:Spacer height="100%"/>
- <mx:Text text="Motorola's New Mobile Unit CEO Sanjay Jha: 'Too Little, Too Late?' - 12 hours ago
- Now that Motorola ( NYSE: MOT) has chosen a CEO for its struggling handset unit, everyone wants to know can Sanjay Jha save the company, ...
- Washington Post - 647 related articles »" color="0xffffff" width="100%" textAlign="center"/>
- <mx:Spacer height="100%"/>
- </mx:VBox>
- </mx:Application>