Flex中通过textSelectedColor样式设置List中选中项目标签颜色的例子

By Minidxer | July 29, 2008

接下来的例子演示了Flex中如何通过textSelectedColor样式,设置List中选中项目标签颜色。

让我们先来看一下Demo可以右键View Source或点击这里察看源代码):


下面是完整实现代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white">
  6.  
  7.     <mx:Array id="arr">
  8.         <mx:Object label="One" />
  9.         <mx:Object label="Two" />
  10.         <mx:Object label="Three" />
  11.         <mx:Object label="Four" />
  12.         <mx:Object label="Five" />
  13.         <mx:Object label="Six" />
  14.         <mx:Object label="Seven" />
  15.         <mx:Object label="Eight" />
  16.         <mx:Object label="Nine" />
  17.         <mx:Object label="Ten" />
  18.     </mx:Array>
  19.  
  20.     <mx:ApplicationControlBar dock="true">
  21.         <mx:Form styleName="plain">
  22.             <mx:FormItem label="textSelectedColor:">
  23.                 <mx:ColorPicker id="colorPicker" />
  24.             </mx:FormItem>
  25.         </mx:Form>
  26.     </mx:ApplicationControlBar>
  27.  
  28.     <mx:List id="list"
  29.             dataProvider="{arr}"
  30.             textSelectedColor="{colorPicker.selectedColor}"
  31.             width="100" />
  32.  
  33. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:minidxer

Topics: Flex | Tags: , ,

Related Post

Leave a Comment

Name(*):

E-Mail(*) :

Website :

Comments :

Search Posts

Archives

Sponsored Ads