how to drag two view simultaneously - android

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.

Related

Drag a view vertically and call a function

I am working on a UI where I need to drag a circular view vertically to a specific circle and when I drag it successfully I need to call a method in Android Kotlin
I created a drag listener but I can drag it all over the screen I don't wanna allow the view to move horizontally.

how to move all the Layouts up when scrolling more in the list view in android

i have a fragment which has a stationary Image View at the top , some linear layouts to display the texts and List View at the Bottom. i want the entire screen to go up(that stationary Image View and middle part) when i scroll down in the List View.
I tried to place all layouts in a single Linear Layout and put it inside Scroll View since it has only one direct child..but that makes only the List view scroll able.
Try using CoordinatorLayout and scrolling behaviour from the design library.You can find a great tutorial here

Drag and copy imageview to another view or framelayout

Trying to create an application where a user drags a view (button/imageView) from a parent layout on top of another layout (probably a framelayout) in a single activity and have it stick to where i dragged it (kind of like a sticker).
The user could repeat this process until the framelayout is filled.
Currently looking at handling onDrag events and on ActionDrop just add a copy of the view being dragged to the new container. Kind of like this except without the removeView method.
Is there a better way? How would i do it if i wanted to place the view being dragged exactly on the same position ontop of the framelayout.

Pannable layout for custom view

I am looking for a layout for my custom views. I have two view with me. Let me call the first view as 'V1' and the other 'V2'.
The V1 will be more like a background for the whole layout. The V2 will be dynamic say, based on the pinch or by a button click the view will zoom. I want this view to get pannable and scrollable so that the user can view V1 even if it grows larger that the screen.
Is there any way I can do this...?
Happy coding..

how to make image view drag and drop on gridview 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!

Categories

Resources