For the previous modification, the modification was made.This time we can achieve a good long press, and then drag down, the background of the item is also up the effect.
Note that the following functions must be modified:
Private void ondrag (int x, int y) {If (dragimageview! = NULL) {windowparams. alpha = 0.6f; windowparams. X = x-dragpointx + dragoffsetx; windowparams. y = Y-dragpointy + dragoffsety; // L. L ("========================= windowparams. y = 000 = "+ windowparams. y); windowmanager. updateviewlayout (dragimageview, windowparams);} int tempscrollx = x-dragpointx + dragoffsetx; int tempscrolly = Y-dragpointy + dragoffsety; int rangey = itemheight; int maxheight = getheig HT ()-rangey; int position = pointtoposition (x, y); int gridviewcount = This. getcount (); int allcontaincount = gridviewcount; int leftcount = gridviewcount % numcolumns; If (leftcount! = 0) {allcontaincount + = (numcolumns-leftcount);} int upmaxposition = allcontaincount-numcolumns; L. L ("=" = position: "+ Position +" MAX: "+ upmaxposition +" count: "+ this. getchildcount () + "rangy:" + rangey); // if the position is greater than the maximum itemif (position> = upmaxposition | position <numcolumns) {L. L ("===== last line ======= postion:" + position); setenabled (false);} else {L. L ("===== good ===== tempscrolly: "+ Tempscrolly +" rangey: "+ rangey +" maxheight: "+ maxheight); If (tempscrolly <rangey) // If the floating view has entered the first line, then the current gridview is slid out of a {L. L ("===== gridview scroll down =======:" + tempscrolly); setenabled (true); int position2 = getfirstvisibleposition (); smoothscrolltoposition (position2-1); // scrollto (0,-itemheight);} elseif (tempscrolly> maxheight) {L. L ("===== gridview scroll up =====:" + tempscrolly); Set Enabled (true); int position1 = getlastvisibleposition (); smoothscrolltoposition (position1 + 1); // scrollto (0, itemheight) ;}} this is all about item dragging. Download Code link: http://download.csdn.net/detail/synwith/4082316