Flex:左下对齐组件?
正如标题所示,有什么方法可以让组件左下对齐吗?
嵌套在 中的
不起作用,因为 HBox< 中的元素/code> 是顶部对齐而不是底部对齐。
例如,我希望我的组件像这样对齐:
+-------------+ <-- container
| components |
| | V |
| V +--+ |
| +-+ | | |
| +-+ +--+ |
+-------------+
As the title suggests, is there any way to bottom-left align components?
An <HBox .../>
nested in a <Canvas .../>
doesn't work because the elements in the HBox
are top-aligned instead of bottom aligned.
For example, I'd like my components to be aligned like this:
+-------------+ <-- container
| components |
| | V |
| V +--+ |
| +-+ | | |
| +-+ +--+ |
+-------------+
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需要在水平盒上设置verticalAlign和horizontalAlign样式,即:
You just need to set the verticalAlign and horizontalAlign styles on the hbox ie:
延伸 HBox 和/或 Box 以更改位置。我怀疑您可能必须重写 updateDisplayList 方法才能更改组件的定位方式。您可能不想将 y 值设置为“0”,而是将其设置为 unscaledHeight-component.width。
Extend the HBox and/or Box to change the positioning. I suspect you'll probably have to override the updateDisplayList method to change the way components are positioned. Probably instead of setting the y value as "0" you'll want to set it to unscaledHeight-component.width.