Android中ListView組件的Item拖動

 

Android中ListView組件的Item拖動(Item改變順序)

分類: Android基礎 956人閱讀 評論(71) 收藏 舉報

1. 引言

 

     此文章介紹如何實現拖動ListView組件的Item,改變Item的位置。效果圖及實現如下。

 

2. 效果圖

 

    (1) 拖動下圖中每一項左邊的把手,上下移動,鬆開時就會改變Item的順序。

          拖放1

    (2) 拖動過程,如下圖所示:

          拖動2

    (3) 拖動後的結果,如下圖所示:

          拖動3

2.  功能實現:

 

      (1) 重寫ListView組件:

  1. /* 
  2.  * Copyright (C) 2008 The Android Open Source Project 
  3.  * 
  4.  * Licensed under the Apache License, Version 2.0 (the "License"); 
  5.  * you may not use this file except in compliance with the License. 
  6.  * You may obtain a copy of the License at 
  7.  * 
  8.  *      http://www.apache.org/licenses/LICENSE-2.0 
  9.  * 
  10.  * Unless required by applicable law or agreed to in writing, software 
  11.  * distributed under the License is distributed on an "AS IS" BASIS, 
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
  13.  * See the License for the specific language governing permissions and 
  14.  * limitations under the License. 
  15.  */  
  16. package com.flora;  
  17. import android.content.Context;  
  18. import android.content.SharedPreferences;  
  19. import android.content.res.Resources;  
  20. import android.graphics.Bitmap;  
  21. import android.graphics.PixelFormat;  
  22. import android.graphics.Rect;  
  23. import android.graphics.drawable.Drawable;  
  24. import android.util.AttributeSet;  
  25. import android.view.GestureDetector;  
  26. import android.view.Gravity;  
  27. import android.view.MotionEvent;  
  28. import android.view.View;  
  29. import android.view.ViewConfiguration;  
  30. import android.view.ViewGroup;  
  31. import android.view.WindowManager;  
  32. import android.view.GestureDetector.SimpleOnGestureListener;  
  33. import android.widget.AdapterView;  
  34. import android.widget.ImageView;  
  35. import android.widget.ListView;  
  36. public class DragAndDropListView extends ListView {  
  37.       
  38.     private ImageView mDragView;  
  39.     private WindowManager mWindowManager;  
  40.     private WindowManager.LayoutParams mWindowParams;  
  41.       
  42.     /** 
  43.      * At which position is the item currently being dragged. Note that this 
  44.      * takes in to account header items. 
  45.      */  
  46.     private int mDragPos;  
  47.       
  48.     /** 
  49.      * At which position was the item being dragged originally 
  50.      */  
  51.     private int mSrcDragPos;  
  52.     private int mDragPointX;   // at what x offset inside the item did the user grab it  
  53.     private int mDragPointY;   // at what y offset inside the item did the user grab it  
  54.     private int mXOffset;  // the difference between screen coordinates and coordinates in this view  
  55.     private int mYOffset;  // the difference between screen coordinates and coordinates in this view  
  56.     private DragListener mDragListener;  
  57.     private DropListener mDropListener;  
  58.     private RemoveListener mRemoveListener;  
  59.     private int mUpperBound;  
  60.     private int mLowerBound;  
  61.     private int mHeight;  
  62.     private GestureDetector mGestureDetector;  
  63.     private static final int FLING = 0;  
  64.     private static final int SLIDE = 1;  
  65.     private static final int TRASH = 2;  
  66.     private int mRemoveMode = -1;  
  67.     private Rect mTempRect = new Rect();  
  68.     private Bitmap mDragBitmap;  
  69.     private final int mTouchSlop;  
  70.     private int mItemHeightNormal;  
  71.     private int mItemHeightExpanded;  
  72.     private int mItemHeightHalf;  
  73.     private Drawable mTrashcan;  
  74.     public DragAndDropListView(Context context, AttributeSet attrs) {  
  75.         super(context, attrs);  
  76.           
  77.         SharedPreferences pref = context.getSharedPreferences("Music"3);  
  78.         mRemoveMode = pref.getInt("deletemode", -1);  
  79.         mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();  
  80.         Resources res = getResources();  
  81.         mItemHeightNormal = res.getDimensionPixelSize(R.dimen.normal_height);  
  82.         mItemHeightHalf = mItemHeightNormal / 2;  
  83.         mItemHeightExpanded = res.getDimensionPixelSize(R.dimen.expanded_height);  
  84.     }  
  85.       
  86.     @Override  
  87.     public boolean onInterceptTouchEvent(MotionEvent ev) {  
  88.         if (mRemoveListener != null && mGestureDetector == null) {  
  89.             if (mRemoveMode == FLING) {  
  90.                 mGestureDetector = new GestureDetector(getContext(), new SimpleOnGestureListener() {  
  91.                     @Override  
  92.                     public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,  
  93.                             float velocityY) {  
  94.                         if (mDragView != null) {  
  95.                             if (velocityX > 1000) {  
  96.                                 Rect r = mTempRect;  
  97.                                 mDragView.getDrawingRect(r);  
  98.                                 if ( e2.getX() > r.right * 2 / 3) {  
  99.                                     // fast fling right with release near the right edge of the screen  
  100.                                     stopDragging();  
  101.                                     mRemoveListener.remove(mSrcDragPos);  
  102.                                     unExpandViews(true);  
  103.                                 }  
  104.                             }  
  105.                             // flinging while dragging should have no effect  
  106.                             return true;  
  107.                         }  
  108.                         return false;  
  109.                     }  
  110.                 });  
  111.             }  
  112.         }  
  113.           
  114.         if (mDragListener != null || mDropListener != null) {  
  115.             switch (ev.getAction()) {  
  116.                 case MotionEvent.ACTION_DOWN:  
  117.                     int x = (int) ev.getX();  
  118.                     int y = (int) ev.getY();  
  119.                       
  120.                     int itemnum = pointToPosition(x, y);  
  121.                     if (itemnum == AdapterView.INVALID_POSITION) {  
  122.                         break;  
  123.                     }  
  124.                       
  125.                     ViewGroup item = (ViewGroup) getChildAt(itemnum - getFirstVisiblePosition());  
  126.                       
  127.                     mDragPointX = x - item.getLeft();  
  128.                     mDragPointY = y - item.getTop();  
  129.                     mXOffset = ((int)ev.getRawX()) - x;  
  130.                     mYOffset = ((int)ev.getRawY()) - y;  
  131.                       
  132.                     // The left side of the item is the grabber for dragging the item  
  133.                     if (x < 64) {  
  134.                         item.setDrawingCacheEnabled(true);  
  135.                           
  136.                         // Create a copy of the drawing cache so that it does not get recycled  
  137.                         // by the framework when the list tries to clean up memory  
  138.                         Bitmap bitmap = Bitmap.createBitmap(item.getDrawingCache());  
  139.                         startDragging(bitmap, x, y);  
  140.                           
  141.                         mDragPos = itemnum;  
  142.                         mSrcDragPos = mDragPos;  
  143.                           
  144.                         mHeight = getHeight();  
  145.                           
  146.                         int touchSlop = mTouchSlop;  
  147.                           
  148.                         mUpperBound = Math.min(y - touchSlop, mHeight / 3);  
  149.                         mLowerBound = Math.max(y + touchSlop, mHeight * 2 /3);  
  150.                           
  151.                         return false;  
  152.                     }  
  153.                       
  154.                     stopDragging();  
  155.                       
  156.                     break;  
  157.             }  
  158.         }  
  159.         return super.onInterceptTouchEvent(ev);  
  160.     }  
  161.       
  162.     /* 
  163.      * pointToPosition() doesn't consider invisible views, but we 
  164.      * need to, so implement a slightly different version. 
  165.      */  
  166.     private int myPointToPosition(int x, int y) {  
  167.         if (y < 0) {  
  168.             // when dragging off the top of the screen, calculate position  
  169.             // by going back from a visible item  
  170.             int pos = myPointToPosition(x, y + mItemHeightNormal);  
  171.             if (pos > 0) {  
  172.                 return pos - 1;  
  173.             }  
  174.         }  
  175.         Rect frame = mTempRect;  
  176.         final int count = getChildCount();  
  177.         for (int i = count - 1; i >= 0; i--) {  
  178.             final View child = getChildAt(i);  
  179.             child.getHitRect(frame);  
  180.             if (frame.contains(x, y)) {  
  181.                 return getFirstVisiblePosition() + i;  
  182.             }  
  183.         }  
  184.           
  185.         return INVALID_POSITION;  
  186.     }  
  187.       
  188.     private int getItemForPosition(int y) {  
  189.         int adjustedy = y - mDragPointY - mItemHeightHalf;  
  190.         int pos = myPointToPosition(0, adjustedy);  
  191.           
  192.         if (pos >= 0) {  
  193.             if (pos <= mSrcDragPos) {  
  194.                 pos += 1;  
  195.             }  
  196.         } else if (adjustedy < 0) {  
  197.             // this shouldn't happen anymore now that myPointToPosition deals  
  198.             // with this situation  
  199.             pos = 0;  
  200.         }  
  201.         return pos;  
  202.     }  
  203.       
  204.     private void adjustScrollBounds(int y) {  
  205.         if (y >= mHeight / 3) {  
  206.             mUpperBound = mHeight / 3;  
  207.         }  
  208.         if (y <= mHeight * 2 / 3) {  
  209.             mLowerBound = mHeight * 2 / 3;  
  210.         }  
  211.     }  
  212.     /* 
  213.      * Restore size and visibility for all listitems 
  214.      */  
  215.     private void unExpandViews(boolean deletion) {  
  216.         for (int i = 0;; i++) {  
  217.             View v = getChildAt(i);  
  218.             if (v == null) {  
  219.                 if (deletion) {  
  220.                     // HACK force update of mItemCount  
  221.                     int position = getFirstVisiblePosition();  
  222.                     int y = getChildAt(0).getTop();  
  223.                     setAdapter(getAdapter());  
  224.                     setSelectionFromTop(position, y);  
  225.                     // end hack  
  226.                 }  
  227.                 try {  
  228.                     layoutChildren(); // force children to be recreated where needed  
  229.                     v = getChildAt(i);  
  230.                 } catch (IllegalStateException ex) {  
  231.                     // layoutChildren throws this sometimes, presumably because we're  
  232.                     // in the process of being torn down but are still getting touch  
  233.                     // events  
  234.                 }  
  235.                 if (v == null) {  
  236.                     return;  
  237.                 }  
  238.             }  
  239.             ViewGroup.LayoutParams params = v.getLayoutParams();  
  240.             params.height = mItemHeightNormal;  
  241.             v.setLayoutParams(params);  
  242.             v.setVisibility(View.VISIBLE);  
  243.         }  
  244.     }  
  245.       
  246.     /* Adjust visibility and size to make it appear as though 
  247.      * an item is being dragged around and other items are making 
  248.      * room for it: 
  249.      * If dropping the item would result in it still being in the 
  250.      * same place, then make the dragged listitem's size normal, 
  251.      * but make the item invisible. 
  252.      * Otherwise, if the dragged listitem is still on screen, make 
  253.      * it as small as possible and expand the item below the insert 
  254.      * point. 
  255.      * If the dragged item is not on screen, only expand the item 
  256.      * below the current insertpoint. 
  257.      */  
  258.     private void doExpansion() {  
  259.         int childnum = mDragPos - getFirstVisiblePosition();  
  260.         if (mDragPos > mSrcDragPos) {  
  261.             childnum++;  
  262.         }  
  263.         int numheaders = getHeaderViewsCount();  
  264.         View first = getChildAt(mSrcDragPos - getFirstVisiblePosition());  
  265.           
  266.         for (int i = 0;; i++) {  
  267.             View vv = getChildAt(i);  
  268.             if (vv == null) {  
  269.                 break;  
  270.             }  
  271.             int height = mItemHeightNormal;  
  272.             int visibility = View.VISIBLE;  
  273.             if (mDragPos < numheaders && i == numheaders) {  
  274.                 // dragging on top of the header item, so adjust the item below  
  275.                 // instead  
  276.                 if (vv.equals(first)) {  
  277.                     visibility = View.INVISIBLE;  
  278.                 } else {  
  279.                     height = mItemHeightExpanded;  
  280.                 }  
  281.             } else if (vv.equals(first)) {  
  282.                 // processing the item that is being dragged  
  283.                 if (mDragPos == mSrcDragPos || getPositionForView(vv) == getCount() - 1) {  
  284.                     // hovering over the original location  
  285.                     visibility = View.INVISIBLE;  
  286.                 } else {  
  287.                     // not hovering over it  
  288.                     // Ideally the item would be completely gone, but neither  
  289.                     // setting its size to 0 nor settings visibility to GONE  
  290.                     // has the desired effect.  
  291.                     height = 1;  
  292.                 }  
  293.             } else if (i == childnum) {  
  294.                 if (mDragPos >= numheaders && mDragPos < getCount() - 1) {  
  295.                     height = mItemHeightExpanded;  
  296.                 }  
  297.             }  
  298.             ViewGroup.LayoutParams params = vv.getLayoutParams();  
  299.             params.height = height;  
  300.             vv.setLayoutParams(params);  
  301.             vv.setVisibility(visibility);  
  302.         }  
  303.     }  
  304.       
  305.     @Override  
  306.     public boolean onTouchEvent(MotionEvent ev) {  
  307.         if (mGestureDetector != null) {  
  308.             mGestureDetector.onTouchEvent(ev);  
  309.         }  
  310.           
  311.         if ((mDragListener != null || mDropListener != null) && mDragView != null) {  
  312.             int action = ev.getAction();   
  313.               
  314.             switch (action) {  
  315.                 case MotionEvent.ACTION_UP:  
  316.                 case MotionEvent.ACTION_CANCEL:  
  317.                     Rect r = mTempRect;  
  318.                     mDragView.getDrawingRect(r);  
  319.                     stopDragging();  
  320.                     if (mRemoveMode == SLIDE && ev.getX() > r.right * 3 / 4) {  
  321.                         if (mRemoveListener != null) {  
  322.                             mRemoveListener.remove(mSrcDragPos);  
  323.                         }  
  324.                         unExpandViews(true);  
  325.                     } else {  
  326.                         if (mDropListener != null && mDragPos >= 0 && mDragPos < getCount()) {  
  327.                             mDropListener.drop(mSrcDragPos, mDragPos);  
  328.                         }  
  329.                         unExpandViews(false);  
  330.                     }  
  331.                     break;  
  332.                       
  333.                 case MotionEvent.ACTION_DOWN:  
  334.                 case MotionEvent.ACTION_MOVE:  
  335.                     int x = (int) ev.getX();  
  336.                     int y = (int) ev.getY();  
  337.                       
  338.                     dragView(x, y);  
  339.                       
  340.                     int itemnum = getItemForPosition(y);  
  341.                       
  342.                     if (itemnum >= 0) {  
  343.                         if (action == MotionEvent.ACTION_DOWN || itemnum != mDragPos) {  
  344.                             if (mDragListener != null) {  
  345.                                 mDragListener.drag(mDragPos, itemnum);  
  346.                             }  
  347.                             mDragPos = itemnum;  
  348.                             doExpansion();  
  349.                         }  
  350.                           
  351.                         int speed = 0;  
  352.                         adjustScrollBounds(y);  
  353.                           
  354.                         if (y > mLowerBound) {  
  355.                             // scroll the list up a bit  
  356.                             if (getLastVisiblePosition() < getCount() - 1) {  
  357.                                 speed = y > (mHeight + mLowerBound) / 2 ? 16 : 4;  
  358.                             } else {  
  359.                                 speed = 1;  
  360.                             }  
  361.                         } else if (y < mUpperBound) {  
  362.                             // scroll the list down a bit  
  363.                             speed = y < mUpperBound / 2 ? -16 : -4;  
  364.                             if (getFirstVisiblePosition() == 0  
  365.                                     && getChildAt(0).getTop() >= getPaddingTop()) {  
  366.                                 // if we're already at the top, don't try to scroll, because  
  367.                                 // it causes the framework to do some extra drawing that messes  
  368.                                 // up our animation  
  369.                                 speed = 0;  
  370.                             }  
  371.                         }  
  372.                         if (speed != 0) {  
  373.                             smoothScrollBy(speed, 30);  
  374.                         }  
  375.                     }  
  376.                     break;  
  377.             }  
  378.             return true;  
  379.         }  
  380.         return super.onTouchEvent(ev);  
  381.     }  
  382.       
  383.     private void startDragging(Bitmap bm, int x, int y) {  
  384.         stopDragging();  
  385.         mWindowParams = new WindowManager.LayoutParams();  
  386.         mWindowParams.gravity = Gravity.TOP | Gravity.LEFT;  
  387.         mWindowParams.x = x - mDragPointX + mXOffset;  
  388.         mWindowParams.y = y - mDragPointY + mYOffset;  
  389.         mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;  
  390.         mWindowParams.width = WindowManager.LayoutParams.WRAP_CONTENT;  
  391.         mWindowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE  
  392.                 | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE  
  393.                 | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON  
  394.                 | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN  
  395.                 | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;  
  396.         mWindowParams.format = PixelFormat.TRANSLUCENT;  
  397.         mWindowParams.windowAnimations = 0;  
  398.           
  399.         Context context = getContext();  
  400.         ImageView v = new ImageView(context);  
  401.           
  402.         v.setBackgroundResource(R.drawable.drag_and_drop_image);  
  403.         v.setPadding(0000);  
  404.         v.setImageBitmap(bm);  
  405.         mDragBitmap = bm;  
  406.         mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);  
  407.         mWindowManager.addView(v, mWindowParams);  
  408.           
  409.         mDragView = v;  
  410.     }  
  411.       
  412.     private void dragView(int x, int y) {  
  413.         if (mRemoveMode == SLIDE) {  
  414.             float alpha = 1.0f;  
  415.             int width = mDragView.getWidth();  
  416.             if (x > width / 2) {  
  417.                 alpha = ((float)(width - x)) / (width / 2);  
  418.             }  
  419.             mWindowParams.alpha = alpha;  
  420.         }  
  421.         if (mRemoveMode == FLING || mRemoveMode == TRASH) {  
  422.             mWindowParams.x = x - mDragPointX + mXOffset;  
  423.         } else {  
  424.             mWindowParams.x = 0;  
  425.         }  
  426.           
  427.         mWindowParams.y = y - mDragPointY + mYOffset;  
  428.         mWindowManager.updateViewLayout(mDragView, mWindowParams);  
  429.         if (mTrashcan != null) {  
  430.             int width = mDragView.getWidth();  
  431.             if (y > getHeight() * 3 / 4) {  
  432.                 mTrashcan.setLevel(2);  
  433.             } else if (width > 0 && x > width / 4) {  
  434.                 mTrashcan.setLevel(1);  
  435.             } else {  
  436.                 mTrashcan.setLevel(0);  
  437.             }  
  438.         }  
  439.     }  
  440.       
  441.     private void stopDragging() {  
  442.         if (mDragView != null) {  
  443.             mDragView.setVisibility(GONE);  
  444.             WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);  
  445.             wm.removeView(mDragView);  
  446.             mDragView.setImageDrawable(null);  
  447.             mDragView = null;  
  448.         }  
  449.         if (mDragBitmap != null) {  
  450.             mDragBitmap.recycle();  
  451.             mDragBitmap = null;  
  452.         }  
  453.         if (mTrashcan != null) {  
  454.             mTrashcan.setLevel(0);  
  455.         }  
  456.     }  
  457.     public void setTrashcan(Drawable trash) {  
  458.         mTrashcan = trash;  
  459.         mRemoveMode = TRASH;  
  460.     }  
  461.     public void setDragListener(DragListener l) {  
  462.         mDragListener = l;  
  463.     }  
  464.       
  465.     public void setDropListener(DropListener l) {  
  466.         mDropListener = l;  
  467.     }  
  468.       
  469.     public void setRemoveListener(RemoveListener l) {  
  470.         mRemoveListener = l;  
  471.     }  
  472.     public interface DragListener {  
  473.         void drag(int from, int to);  
  474.     }  
  475.     public interface DropListener {  
  476.         void drop(int from, int to);  
  477.     }  
  478.     public interface RemoveListener {  
  479.         void remove(int which);  
  480.     }  
  481. }   

 

      (2) 主佈局(main.xml)實現:

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"  
  3.     android:orientation = "vertical"  
  4.     android:layout_width = "fill_parent"  
  5.     android:layout_height = "fill_parent"  
  6.     >  
  7.       
  8.     <com.flora.DragAndDropListView  
  9.         android:id = "@android:id/list"  
  10.         android:layout_width = "match_parent"  
  11.         android:layout_height = "match_parent"  
  12.         android:layout_weight = "1"  
  13.         android:textSize = "18sp"  
  14.         android:drawSelectorOnTop = "false"  
  15.         android:fastScrollEnabled = "true"   
  16.         />   
  17. </LinearLayout>  

 

      (3) 主Activity實現:

  1. package com.flora;  
  2. import java.util.ArrayList;  
  3. import java.util.Arrays;  
  4. import android.app.ListActivity;  
  5. import android.os.Bundle;  
  6. import android.view.LayoutInflater;  
  7. import android.view.View;  
  8. import android.view.ViewGroup;  
  9. import android.widget.ArrayAdapter;  
  10. import android.widget.TextView;  
  11. public class DragAndDropListViewActivity extends ListActivity {  
  12.       
  13.     @Override  
  14.     public void onCreate(Bundle savedInstanceState) {  
  15.         super.onCreate(savedInstanceState);  
  16.           
  17.         setContentView(R.layout.main);  
  18.           
  19.         mDragAndDropListView = (DragAndDropListView) getListView();  
  20.           
  21.         mDragAndDropListView.setCacheColorHint(0);  
  22.         mDragAndDropListView.setDivider(null);  
  23.         mDragAndDropListView.setSelector(R.drawable.drag_and_drop_list_background);  
  24.         mDragAndDropListView.setDropListener(mDropListener);  
  25.         mDragAndDropListView.setRemoveListener(mRemoveListener);  
  26.           
  27.         mDragAndDropListViewAdapter = new DragAndDropListViewAdapter();  
  28.           
  29.         setListAdapter(mDragAndDropListViewAdapter);  
  30.     }  
  31.     private class DragAndDropListViewAdapter extends ArrayAdapter<String> {  
  32.         public DragAndDropListViewAdapter() {  
  33.             super(DragAndDropListViewActivity.this, R.layout.drag_and_drop_list_item, mMusicArrayList);  
  34.         }  
  35.         @Override  
  36.         public View getView(int position, View cacheView, ViewGroup parent) {  
  37.             if (cacheView == null) {  
  38.                 LayoutInflater layoutInflater = getLayoutInflater();  
  39.                 cacheView = layoutInflater.inflate(R.layout.drag_and_drop_list_item, parent, false);  
  40.             }  
  41.               
  42.             TextView lineOne = (TextView) cacheView.findViewById(R.id.line1);  
  43.             lineOne.setText("音樂" + mMusicArrayList.get(position));  
  44.               
  45.             TextView lineTwo = (TextView) cacheView.findViewById(R.id.line2);  
  46.             lineTwo.setText("音樂播放列表項, 這是第"+ mMusicArrayList.get(position) +"項!");  
  47.               
  48.             return cacheView;  
  49.         }  
  50.     }  
  51.     private DragAndDropListView.DropListener mDropListener = new DragAndDropListView.DropListener() {  
  52.         public void drop(int from, int to) {  
  53.             String item = mDragAndDropListViewAdapter.getItem(from);  
  54.             mDragAndDropListViewAdapter.remove(item);  
  55.             mDragAndDropListViewAdapter.insert(item, to);  
  56.         }  
  57.     };  
  58.       
  59.     private DragAndDropListView.RemoveListener mRemoveListener =  new DragAndDropListView.RemoveListener() {  
  60.         public void remove(int which) {  
  61.             mDragAndDropListViewAdapter.remove(mDragAndDropListViewAdapter.getItem(which));  
  62.         }  
  63.     };  
  64.       
  65.     private DragAndDropListView mDragAndDropListView;  
  66.       
  67.     private DragAndDropListViewAdapter mDragAndDropListViewAdapter;  
  68.       
  69.     private String [] mMusics = {"0""1""2""3""4""5""6""7""8""9"};  
  70.     private ArrayList<String> mMusicArrayList = new ArrayList<String>(Arrays.asList(mMusics));  
  71. }  

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章