在Flex中 和表格最接近的组件就是Grid了(但是默认的方式只是用来layout,不会显示表格的边框),
把Grid拖放到容器中,输入行列数。在文件中加入如下css代码
就可以看到黑边框的表格了!
<mx:Style>
? ? Grid{
? ? ? ? horizontalGap:0;
? ? ? ? verticalGap:0;
? ? ? ? borderThickness:1;
? ? ? ? borderSides:bottom,right;
? ? ? ? borderStyle:solide;
? ? ? ? borderColor:#000000;
? ? }
? ? GridItem{
? ? ? ? borderSides:left,top;
? ? ? ? borderThickness:1;
? ? ? ? borderStyle:solid;
? ? ? ? borderColor:#000000;
? ? }
</mx:Style>
?
可以用<mx:Grid width="100%" height="100%" horizontalGap="0" verticalGap="0">
? ?? ?? ?<mx:GridRow width="100%" height="20" >
? ? ? ?? ???<mx:GridItem width="15%" borderStyle="solid" borderThickness="1" verticalAlign="middle" horizontalAlign="center">
? ? ? ?? ?? ?? ?<mx:label text="销售单位"/>
? ? ? ?? ???</mx:GridItem>
? ? ? ?? ???<mx:GridItem colSpan="3" width="85%" borderStyle="solid" borderThickness="1">
? ? ? ?? ?? ?? ?<mx:TextInput borderStyle="none" width="100%"/>
? ? ? ?? ???</mx:GridItem>
? ?? ?? ?</mx:GridRow>
? ???</mx:Grid>
就像HTML里的table一样,
GridRow 相当于行
GridItem相当于列,
再用colspan或者rowspan进行合并,达到你想要的效果