gpt4 book ai didi

android - 在 Flex 4.5 中让 textEdit 填充宽度

转载 作者:行者123 更新时间:2023-11-30 04:29:30 25 4
gpt4 key购买 nike

我如何在 Flex 4.5 中创建一个组件(将其用于 android..),它有一个 textInput 并且在其右侧有一个按钮,这样按钮具有固定大小并且 textInput 扩展以填充父级的剩余空间组件的?

这是组件..

<s:HGroup>
<s:TextInput width="????"/>
<s:Button width="37" height="37" />
</s:HGroup>

当然我不知道在宽度中放什么..我是否也应该为 HGroup 指定一个宽度?

最佳答案

Flex 根据子项的父项确定相对大小。

如果您不给父组一个宽度,那么 TextInput 不知道它应该填充到 100%。

<s:HGroup width="100%">
<s:TextInput width="100%"/>
<s:Button width="37" height="37" />
</s:HGroup>

作为对“将它们都设置为 100%”答案的回应的旁注。Flex 将允许您将超过一个百分比的宽度设置为 100%。 2 最终将被同等加权。所以

<s:HGroup width="100%">
<s:TextInput width="100%"/>
<s:Button width="100%"/>
</s:HGroup>

将导致 2 个组件都占据屏幕的一半。

<s:HGroup width="100%">
<s:TextInput width="200%"/>
<s:Button width="100%"/>
</s:HGroup>

将导致 TextInput 的宽度是 Button 的两倍

如果你想从 ActionSript 而不是 MXML 设置基于百分比的高度和宽度,你需要说 textInput.percentWidth = 100;

关于android - 在 Flex 4.5 中让 textEdit 填充宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7960972/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com