将项目渲染器置于 HorizontalList 中居中
I am trying to center itemRenderers in a horizontal list if the number of items in the list is less than the maximum visible number. Has anyone found a good way to do this?
See an illustration of what I mean if it is hard to picture.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
覆盖measure()方法 - 我在这里写了一篇博客文章: http://flexmonkey.blogspot.com/2010/05/centre-aligned-horizontallist-in-flex.html
西蒙
Override the measure() method - I've writen a blog entry here: http://flexmonkey.blogspot.com/2010/05/centre-aligned-horizontallist-in-flex.html
simon
我想到的一种解决方案是添加不可见渲染器以实现相同的居中效果。
One solution that comes to mind would be to add invisible renderers to achieve the same centering.
您可能需要考虑使用水平框或“Hbox”而不是水平列表组件。这将允许您使用水平对齐属性来设置中心。如果没有,只需扩展水平列表组件以接受居中对齐属性,然后将其从水平盒复制到新的扩展组件即可。
You might want to consider using a horizontal box or "Hbox" instead of a horizontal list component. This will allow you to use the horizontal align property to set center. If not, simply extend the horizontal list component to accept a center align property, and copy it from the hbox to your new extended component.
paddingRight 或 paddingLeft 能满足您的需求吗?如果将其与设置columnWidth 和columnCount 结合起来,则可以调整项目首次出现的位置。
Would paddingRight or paddingLeft accomplish what you're looking for? If you combine it with setting the columnWidth and the columnCount, that would allow you to adjust where the items first appear.