垂直对齐 Spark DataGrid 行中的文本
人们可能会认为这类事情很容易——也许确实如此。
我想让 DataGrid 行的高度比默认值大一点。问题在于文本与行顶部垂直对齐。我想将它垂直对齐到行的中间。
有没有办法通过 Flex 4.6 中的 CSS 或 Skinning 来做到这一点?请注意,我使用的是 Spark DataGrid,而不是 MX 版本。
谢谢,
-维克
One would think that these kinds of things are easy - and maybe they are.
I would like to make the height of my DataGrid rows a bit larger than the default. The problem is that the text is vertically align to the top of the row. I would like to vertically align it to the middle of the row.
Is there a way of doing that via CSS or Skinning in Flex 4.6? Please note that I am using a Spark DataGrid and not an MX version.
Thanks,
-Vic
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要创建自定义网格项目渲染器:
CustomGridItemRenderer.mxml:
并将其分配给数据网格的属性“itemRenderer”。就是这样:)
You need to create custom grid item renderer:
CustomGridItemRenderer.mxml:
And assign it to datagrid's property "itemRenderer". That's it:)
就我而言,我还创建了一个自定义网格项渲染器,但我使用了 DefaultGridItemRenderer 来代替 GridItemRenderer:
这里的技巧是使用 textAlign。
In my case I also created a custom grid item renderer, but instead a GridItemRenderer I used the DefaultGridItemRenderer:
The trick here is to play with the textAlign.