2017-02-09 7 views

ответ

0

Если вы хотите показать всплывающую подсказку, когда ширина данных больше ширины списка, вы можете использовать встроенный itemrenderer для нее.

<s:itemRenderer> 
     <fx:Component> 
      <s:ItemRenderer> 
       <s:Label text="{data.Expense}" 
         width="100" 
         maxDisplayedLines="1" 
         showTruncationTip="true" /> 
      </s:ItemRenderer> 
     </fx:Component> 
    </s:itemRenderer> 
1

Если label отображается в list, отличается от toolTip вы хотите показать, то вы можете использовать toolTip свойство Label в ответ SUMIT как ниже:

<?xml version="1.0"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark"> 
<fx:Script><![CDATA[ 
    import mx.collections.ArrayCollection; 
    [Bindable] 
    private var myDataProvider:ArrayCollection = new ArrayCollection([ 
     {data:1, label:"One", desc:"Here is a toolTip description of the item One"}, 
     {data:2, label:"Two", desc:"Here is a toolTip description of the item Two"}, 
     {data:3, label:"Three", desc:"Here is a toolTip description of the item Three"}, 
     {data:4, label:"Four", desc:"Here is a toolTip description of the item Four"}, 
     {data:5, label:"Five", desc:"Here is a toolTip description of the item Five"} 
    ]); 
    ]]></fx:Script> 
    <s:List dataProvider="{myDataProvider}"> 
     <s:itemRenderer> 
      <fx:Component> 
       <s:ItemRenderer> 
        <fx:Script><![CDATA[ 
         override public function set data(value:Object):void 
         { 
          super.data = value; 
         } 
         [Bindable] 
         private function getToolTip():String 
         { 
          return data.desc; 
         } 
         ]]></fx:Script> 
        <s:Label text="{data.label}" toolTip="{getToolTip()}" width="100%"/> 
       </s:ItemRenderer> 
      </fx:Component> 
     </s:itemRenderer> 
    </s:List> 
</s:Application> 

enter image description here