【问题标题】:How to change Spark BorderContainer default height?如何更改 Spark BorderContainer 默认高度?
【发布时间】:2011-09-29 22:08:56
【问题描述】:

如何创建像 HGroup 这样的水平布局容器,但有边框和边框半径?

在这个例子中,有一些默认高度:

<s:BorderContainer width="100%" borderWeight="2" cornerRadius="5">
  <s:layout>
     <s:HorizontalLayout/>
  </s:layout>
  <s:Image source="image.png" />
  <mx:Text text="text example" />
</s:BorderContainer>

我希望它具有容器中最高元素的高度。就像在 HGroup 中一样。

补充:为什么上面例子BorderContainer的高度等于112?

【问题讨论】:

    标签: apache-flex layout flex4


    【解决方案1】:

    @Nemi 只需将 BorderContainer 的 minHeight 属性设置为 0

    【讨论】:

      【解决方案2】:

      很难获得容器中最高元素的高度。

      我的建议是这样使用更好

      <s:BorderContainer width="100%" height="{hGroup.height}" borderWeight="2" cornerRadius="5">
        <s:HGroup width="100%" id="hGroup">
           <s:Image source="image.png" />
           <mx:Text text="text example" />    
        </s:HGroup>     
      </s:BorderContainer>
      

      这可能会将最高的子高度设置为borderContainer。

      【讨论】:

      • 谢谢 :) 这给了我想要的。那么有没有办法有HGroup边框呢?也许用 CSS?
      猜你喜欢
      • 2016-06-08
      • 1970-01-01
      • 1970-01-01
      • 2016-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多