2011-04-19 50 views
1

我试图自动调整s:Group内的子组的大小。孩子们是另一个:集团和一个H:集团。每个的百分比宽度分别为10%和90%。问题是,当其中一个组的大小被调整(在皮肤中使用转换和旋转组合)时,另一个组不会自动调整大小以填充空间?Flex 4调整组中的组

不应该自动执行此操作吗?还是我必须编码?

<s:Group 
    id="listsGroup" 
    width="100%" 
    height="255" 
    > 

    <s:Label text="LIST WITH HEADER TEST" styleName="h1" /> 

    <s:Group 
     id="listsGroupSavedSearches" 
     width="10%" 
     height="255" 
     > 
     <components1:ListWithHeader 
      id="categories11" 
      dataProvider="{listModel}" 
      headerLabel="Saved Searches" 
      allowMultipleSelection="true" 
      top="10" bottom="0" 
      left="0" width="10%" 
      /> 
    </s:Group> 

    <s:HGroup left="160" width="90%" height="150" top="50" gap="6"> 
     <components1:ListWithHeader 
      id="categories1" 
      dataProvider="{listModel}" 
      headerLabel="Category1 " 
      allowMultipleSelection="true" 
      width="100%" 
      height="150" 
      /> 
     <components1:ListWithHeader 
      id="categories2" 
      dataProvider="{listModel}" 
      headerLabel="Category2" 
      allowMultipleSelection="true" 
      width="100%" 
      height="150" 
      /> 
     <components1:ListWithHeader 
      id="categories3" 
      dataProvider="{listModel}" 
      headerLabel="Category3" 
      allowMultipleSelection="true" 
      width="100%" 
      height="150" 
      /> 
    </s:HGroup> 
</s:Group> 
+0

我之前有过类似的问题,可能会尝试删除第二个%的宽度?或将其设置为100%?我知道,有时当flex绘制的东西他们不会以我期望的方式去做 – Mike 2011-04-19 13:32:23

+0

您可能想尝试用'HGroup'替换顶部的'Group'。我相信'Group'组件是基于'x''y' coord的,并且不像'HGroup'或'VGroup'那样流畅。 – 2011-04-19 15:15:33

+0

Garbage 2011-04-21 12:50:51

回答

0

接近这样的事情最好的办法是绑定到Flex组件生命周期方法,特别是updateDisplayList()。 UpdateDisplayList()用于定位和调整您的孩子。它有两个参数,即组件的高度和宽度。然后,您可以根据组件的高度和宽度编写算法来确定您的孩子的大小和位置。

MXML在引擎盖下做到了这一切,有种黑魔法;但如果您自己编写布局代码,您将获得更多控制权。