Layout 如何使组在包含RichText的垂直宽度内可见,并将其高度设置为适合RichText?

Layout 如何使组在包含RichText的垂直宽度内可见,并将其高度设置为适合RichText?,layout,flex4,Layout,Flex4,在这里,我想使notifyPanel在更改为其状态后可见,并进行平滑转换。但是我想让notifyText有它自己的高度,我的意思是,如果它是多行的,有一些高度,如果不是,有其他的高度。因此,我不能将notifyPanel.height设置为20 <s:Group width="100%" height="100%" minHeight="10"> <s:layout> <s:VerticalLayout gap="0"/>

在这里,我想使notifyPanel在更改为其状态后可见,并进行平滑转换。但是我想让notifyText有它自己的高度,我的意思是,如果它是多行的,有一些高度,如果不是,有其他的高度。因此,我不能将notifyPanel.height设置为20

<s:Group width="100%" height="100%" minHeight="10">
        <s:layout>
            <s:VerticalLayout gap="0"/>
        </s:layout>

<!-- Here I want to make notifyPanel visible after changed to it's state, with a smooth transition. But I want to let the notifyText to have it's own height, what I mean is that if it's multiline has some height if not, have other. Because of this i can't just set the notifyPanel.height = 20 -->
        <s:Group id="notifyPanel" width="100%" minHeight="0">
            <s:Rect height="100%" width="100%">
                <s:fill>
                    <s:SolidColor color="#48E200"/>
                </s:fill>
            </s:Rect>
            <s:RichText id="notifyText" color="#ffffff" top="5" left="10" bottom="5" right="10" text="RichText"/>
        </s:Group>


        <s:Group height="100%" width="100%">
            <s:Rect height="100%" width="100%">
                <s:fill>
                    <s:SolidColor color="#FFFFFF"/>
                </s:fill>
            </s:Rect>
            <s:Group id="contentGroup" left="0" right="0" top="0" bottom="0" minWidth="0" minHeight="0"/>
        </s:Group>


    </s:Group>

删除notifyPanel上的宽度和高度,这将使其大小与其内容相符。同时删除notifyText上的约束,使其大小与内容一致。通过在Notify面板上设置minHeight和maxHeight来控制总体约束

<s:Group id="notifyPanel">
   <s:Rect height="100%" width="100%">
       <s:fill>
          <s:SolidColor color="#48E200"/>
       </s:fill>
   </s:Rect>
   <s:RichText id="notifyText" color="#ffffff" text="RichText"/>
</s:Group>