【问题标题】:How to position an element on the Y-Axis based on an Item [SAPUI5] [closed]如何根据项目在 Y 轴上定位元素 [SAPUI5] [关闭]
【发布时间】:2020-11-25 16:25:30
【问题描述】:

正如标题所述,我在一个HBox 中确实有两个元素,一个link 和一个button,问题是我希望链接显示在与中间相同的行高中button.

代码:

<HBox>
    <Link text="Hallo Welt"/>
    <Button 
        icon="sap-icon://warning2" class="sapUiSmallMarginBegin"/>
        
</HBox>

链接现在在哪里:

链接的位置:

问题:如何将link定位在Button的中间?

【问题讨论】:

  • 链接和按钮的组合在语义上代表什么?您可能希望使用支持新闻事件和图标的sap.m.ObjectStatus。或者透明的sap.m.ButtoniconFirst="false" 怎么样?无论如何,如果您可以添加您实际尝试实现的内容以避免常见的xy-problems,那就太好了。

标签: hyperlink position sapui5 text-align


【解决方案1】:

这不是很直观,但HBox 的正确示例可以在FlexBox 中找到。

请参阅 the sample page 了解不同的对齐方式。

你可能想要

<HBox alignItems="Center" justifyContent="Start">

但正如@Boghyon 在他的评论中所写,如果您的用例不同,可能会有更好的方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-18
    • 1970-01-01
    相关资源
    最近更新 更多