0
這是將屏幕分爲左右兩列的代碼。然後它在每列中放入一個框並嘗試將它們居中。該horizontalCenter和verticalCenter屬性將被忽略:爲什麼在Spark(Flex 4)中horizontalCenter和verticalCenter不工作?
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
backgroundColor="blue">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:SkinnableContainer id="mainContentArea"
top="100" bottom="100"
backgroundColor="red">
<s:layout>
<s:ConstraintLayout>
<s:constraintColumns>
<s:ConstraintColumn id="col1" width="{width/2}" />
<s:ConstraintColumn id="col2" width="{width/2}" />
</s:constraintColumns>
</s:ConstraintLayout>
</s:layout>
<s:BorderContainer id="greenContainer"
backgroundColor="green"
width="400" height="300"
horizontalCenter="col1:0"
verticalCenter="0">
</s:BorderContainer>
<s:BorderContainer id="yellowContainer"
backgroundColor="yellow"
width="200" height="150"
horizontalCenter="col2:0"
verticalCenter="0">
</s:BorderContainer>
</s:SkinnableContainer>
</s:Application>
謝謝回答。 – Robert
那麼如何在Spark中實現相同的功能呢?爲什麼這改變了? MX中的相同代碼工作(使用Canvas)。 – Robert
我想你應該用'left = right = top = bottom =「0」'放置一個'Group',然後用'verticalCenter'和'horizontalCenter'將它放在它的內部。而且我還沒有回答這個問題的第二部分,因爲我對Adobe的動機沒有任何想法。 – Constantiner