竖直方向居中对齐Flex的Text控件中文本

By Minidxer | August 6, 2008

做法其实很简单,将Text装入VBox中,然后在Text周围封装两个Spacer,前后各一个,高度设置为100,搞定~下面是具体的代码:


Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
  3.     <mx:VBox verticalAlign="middle" width="300" height="400" backgroundColor="0x000000" borderStyle="solid" borderColor="0x000000" cornerRadius="6">
  4.  
  5.  
  6.         <mx:Spacer height="100%"/>
  7.         <mx:Text text="Motorola's New Mobile Unit CEO Sanjay Jha: 'Too Little, Too Late?' - 12 hours ago
  8. Now that Motorola ( NYSE: MOT) has chosen a CEO for its struggling handset unit, everyone wants to know can Sanjay Jha save the company, ...
  9. Washington Post - 647 related articles »" color="0xffffff" width="100%" textAlign="center"/>
  10.         <mx:Spacer height="100%"/>
  11.  
  12.  
  13.     </mx:VBox>
  14. </mx:Application>

Topics: Adobe其他 | Tags: , ,

Search Posts

Archives

Sponsored Ads