flexniu
2014-03-12 14:15:10
证
Flex 四种方式设置dataGrid表头颜色
有时候需要改变dataGrid表头颜色,整理了四种方式,大家还有其他方式可以讨论下。
1.直接通过as代码设置
grid1.setStyle("headerColors", ["red", "blue"]);
2.使用MXML标签设置
<mx:DataGrid id="grid2" dataProvider="{arr}" height="100%"> <mx:headerColors> <fx:String>#FF0000</fx:String> <fx:String>0x0000FF</fx:String> </mx:headerColors> <mx:columns> <mx:DataGridColumn dataField="c1" headerText="列 1" /> <mx:DataGridColumn dataField="c2" headerText="列 2" /> <mx:DataGridColumn dataField="c3" headerText="列 3" /> </mx:columns> </mx:DataGrid>
3.使用CSS设置
#grid3 { headerColors: #FF0000,'0x0000FF'; }
4.设置组件属性headColors
<mx:DataGrid id="grid4" headerColors="[#FF0000, 0x0000FF]">
不过这四种方式都只能在halo主题下才能生效,这个比较关键,很多人说不起作用应该就是这个原因。
预览效果:
猜你喜欢
请下载代码后再发表评论
![最代码相关代码源代码列表](https://static.zuidaima.com/resource/img/heart_ico.png)
![最代码最近浏览分享源代码列表](https://static.zuidaima.com/resource/img/cattle_ico.png)
游客169732745
2023年5月8日
暂无贡献等级
2750319260 LV1
2021年10月9日
epeng89
2021年6月21日
暂无贡献等级
gao123qq LV21
2018年12月22日
lxc612988 LV7
2018年11月21日
454185051 LV13
2018年7月9日
xinjianliuxingyu LV2
2018年5月15日
luke8848 LV3
2018年1月31日
wwj0214 LV25
2018年1月3日
houjx123 LV1
2017年12月5日