Flex 拉伸菜单栏项目

发布于 2024-11-27 06:56:59 字数 249 浏览 6 评论 0原文

我在 Flex 中使用 MenuBar:

<mx:MenuBar labelField="@label"
        width="100%"
        cornerRadius="0">
...
</mx:MenuBar>

通过将宽度指定为 100%,菜单栏可以根据需要延伸到整个容器,但我也希望内部的项目延伸到最大可能的宽度,而不是简单地与左侧对齐。

这可能吗?

I am using a MenuBar in Flex:

<mx:MenuBar labelField="@label"
        width="100%"
        cornerRadius="0">
...
</mx:MenuBar>

By specifying the width as 100% the menu bar stretches across the entire container as desired, but I would also like the items inside to stretch to their maximum possible width instead of simply aligning to the left side.

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我的鱼塘能养鲲 2024-12-04 06:56:59

您可能想考虑为您的菜单创建自定义 ItemRenderer。我根本没有使用过 MenuBar,但快速浏览后我发现它有一个 menuBarItemRenderer 属性。您可能需要创建自己的渲染器才能完成您想要的操作。如果您选择走这条路,请不要忘记实现正确的接口并覆盖数据设置函数(应该很容易在网上找到教程)

You may want to look into creating a custom ItemRenderer for your menu. I haven't played with a MenuBar at all, but in a quick lookover I see that it has a menuBarItemRenderer property. You may need to create your own renderer to have it do what you're looking for. Don't forget to implement the correct interfaces and override the data setting functions if you choose to go this route (should be easy to find tutorials online)

无远思近则忧 2024-12-04 06:56:59

当您将项目添加到菜单栏时,您还可以将其宽度设置为 100%。这给了我想要的效果;或者,将项目放置在宽度为 100% 的 HGroup 中以覆盖菜单栏格式。

When you add items to the menu bar, you can also set their width to 100%. This gives the desired effect for me; alternatively, place the items in a HGroup with 100% width to override the menubar formatting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文