Skip to content
Advertisement

How I can position an Imageview On Runtime at specific coordinates during on a DragEvent?

My app has the following view:

JavaScript

And the Following activity:

JavaScript

At the following lines:

JavaScript

I try to place an image into a view but I fail to do so. My aim with this activity is to draw and reposition some items on a Custom Layout? What I want is some sort of view where I can position the ImageView.

Do you know how I can do that?

Advertisement

Answer

The appropiate layout is the ConstraintLayout And the reason why is because it allows you to position an item to specific X and Y positions.

The activity view should be:

JavaScript

So in the onDrag action to be able to do:

JavaScript

Pay attention to the following lines:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement