how to make image view drag and drop on gridview android - android

i want to Override the onTouch event and get the image view from the gridview
and drag it to new place on the grid ?

I'm not sure if this is the kind of thing you're looking for, but here's a drag-and-drop grid I developed that might help you:
https://github.com/thquinn/DraggableGridView
It allows you to long press a child view and drag it to another position in the grid. It's animated, too!

Related

how to drag two view simultaneously

I just want to know how to drag two views at the same time
first view is its original image view
Second one is its shadow
I am using dragShadow builder to build a drag shadow but when I drag a view using touchlistner it is only drag shadow of my main view and the main view is stick on their position ..
so my question is Is there any solution to enable drag both view simultaneously?
thank you for any kind of suggestion..
attach a picture
Wrap both ImageView and shadow in ViewGroup, for example, FrameLayout, and drag FrameLayout instead of ImageView.

Android: Detect if user touches a view inside parent view

I have 40 ImageViews inside a GridLayout, they have different colors and I want to know if user touched the desirable image or somewhere else(for example if user touched red image). How should I do that?
Set an OnClickListener for each view and store the views. In onClick you can check the view and know what ImageView was clicked. You could also think about changing the type to ImageButtons!
If you have further problems with your Grid not being able to be clicked, check this out: http://cyrilmottier.com/2011/11/23/listview-tips-tricks-4-add-several-clickable-areas/
TLDR: Disable focusing of the views in your layout.
If you manage your images in a collection maybe think about switching to gridview and implement an adapter with an itemClickListener. So depend on which item is clicked do you action.
How GridLayout items come from the Adapter(List/Image) in Android App

Shifting touch focus from one recycle view to another

I am new to android development and got stuck with this.
I have implemented drag and drop for recycle view using ItemTouchHelper.Callback. Now drag and drop is working perfectly within the recycler view. But in my case, i have two recycler views and i want to drag item from one recycler view to another. Is there any ways to achieve this using ItemTouchHelper.Callback?
Thanks in advance.

How to stagger imageViews freely around a layout? (pic included)

I want to stagger images or buttons around a layout in an artsy way so that they look like this wall
Any ideas on which layout to use or how to do this ?
Thanks for any help
or like this wall
for this you can follow this.
1- Create a recycler view with staggered layoutmanager.
2- Every child of recycler view implements onDragListener. you will get onDragEnter and exit evnets from there.
3- call startDrag of view on long press of a view. Keep track of which child you are dragging.
4- on Drop event just swap the values.
This is just a thought. with some more logic around, you can implement this.

How to drag and Drop a view from image view to a listview?

I have image view on left side and a list view on right side. I want to drag the image view from left side to list view in right side. I have seen many examples in which a view can be moved from one view to another, provided all lies in the same layout. My problem arises here. My list view and image view both are in different layout. Also for tablet design, both image view and list view are in different fragments. So how can I drag and Drop image from one fragment to another. Could anyone guide me to the right way to do it in both cases. Any help in this case is highly appreciable.

Categories

Resources