Hi Frank....

I'm not sure I fully understand what effect you are trying to achieve withe 
drag and drop on a gridview (do you have an example to look at by any 
chance?).  I may have done something similar with a custom listview though.

To do drag and drop on my custom listview I don't make a space for my 
dragged object: instead I double the height of the row that is currently 
underneath the dragged object (which I assume is the shadow object in your 
email).  In this way the touch events should continue to be registered. 
 Once the dragged row is dragged more than 50% over the covered row I flip 
the location of the text so that it remains visible.  As soon as the 
dragged object touches the next row I reset the previous one to the 
original height and double the size of the new 'covered' view.

In addition you need to change the height of the original dragged view down 
to 1 pixel rather than changing the visibility of it.

In this way my dragged object always has the listview under it and is never 
'between' two items.

Much as I'd like to claim that I came up with this clever trick myself I'm 
afraid I cannot: if you study the source for Google Music you can see it in 
action there....also if I recall correctly I think the estimable Mark 
Murphy extracted the useful bits from that app to build a custom listview 
class that you should be able to download from his site.

Apologies if I completely misunderstood your problem!

Best,

Nick


On Wednesday, December 19, 2012 4:23:49 AM UTC-5, Frank wrote:
>
> I created a drag and drop gridview (using an 'OnDragListener'). Grid items 
> can be dropped upon one another. However, I also want to be able to 
> re-order them. I implemented this, but there is a major issue left standing:
>
> When I drag around my shadow object I want the items to make space for my 
> dragged object while I am dragging it around. I already implemented the 
> moving of the other items, but I cannot seem to figure out a way to find 
> out IF/WHEN I am in between two items. I get drag events when I hoover 
> ABOVE an item, but not in between then. The gridview does not get any 
> 'onTouchEvent' calls when I am dragging, not even 'onInterceptTouchEvent' 
> calls.
>
> Does anyone know a way in which I can implement this? 
>
> I already tried:
>
> 1. Implementing 'onTouchEvent' and 'onInterceptTouchEvent' in the 
> gridview. Problem: 
> The gridview does not get any 'onTouchEvent' calls when I am dragging an 
> item, not even 'onInterceptTouchEvent' calls.
>
> 2. Setting another 'draglistener' on the whole gridview. Problem: 
> 'ACTION_DRAG_LOCATION' gets only called a few times, not on every move 
> (location change), as is documented (!!).

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to