2013-02-26 33 views
2

我想通過用手指拖動它們在Flex移動應用程序中重新排列List中的項目。在火花列表中拖動列表在Flex移動應用程序中不起作用?附帶測試用例和屏幕截圖

作爲第一步,我抄從Adobe文檔Using drag-and-drop with list-based controls的例子 - 但是,而他們的示例工作細如Web應用程序,什麼也沒有發生在下面的移動應用程序:

screenshot

爲什麼沒有工作(就像是在移動主題中的一些皮膚缺失?)

有沒有辦法讓它工作(至少重新排序移動列表中的項目)?

下面是一個簡單的測試代碼我試過 - 只是把它變成一個新的空白(即沒有導航欄。)Flex手機項目在Flash Builder:

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       applicationDPI="160" 
       creationComplete="initApp()"> 

    <s:layout> 
     <s:VerticalLayout/> 
    </s:layout> 

    <fx:Script> 
     <![CDATA[ 
      import mx.collections.ArrayCollection; 

      private function initApp():void { 
       srclist.dataProvider = 
        new ArrayCollection(['Reading', 'Television', 'Movies']); 
       destlist.dataProvider = new ArrayCollection([]); 
      } 
     ]]> 
    </fx:Script> 

    <s:HGroup> 
     <s:VGroup> 
      <s:Label text="Available Activities"/> 
      <s:List id="srclist" 
        allowMultipleSelection="true" 
        dragEnabled="true" 
        dragMoveEnabled="true"/> 
     </s:VGroup> 

     <s:VGroup> 
      <s:Label text="Activities I Like"/> 
      <s:List id="destlist" 
        dropEnabled="true"/> 
     </s:VGroup> 
    </s:HGroup> 

    <s:Button id="b1" 
       label="Reset" 
       click="initApp();"/> 

</s:Application> 
+1

這不是在移動Flex的列表來實現。我懷疑這是有記載的地方;但我不知道在哪裏。你將不得不推出自己的下拉和拖放工作與移動列表。 – JeffryHouser 2013-02-26 16:11:21

回答

1

我發現並試圖我自己是一個超級解決方案this page

只需從他的示例中複製類並將自定義itemRenderer添加到源列表。

 <s:List id="srclist" 
       allowMultipleSelection="true" 
       dragEnabled="true" 
       dragMoveEnabled="true"> 
      <s:itemRenderer> 
       <fx:Component> 
        <local:DraggableIconItemRenderer decorator="{DragThumb}" /> 
       </fx:Component> 
      </s:itemRenderer> 
     </s:List> 

尊重作者!

下面是結果:

enter image description here

相關問題