How can I drag a imagebutton in android?

This blog has two very nice examples of how you can use touch events to move any kind of view around the screen.

Thanks, trying to analyze the code. If there is a way to assign the values of event.getX() and event.getY() to the view, then that will make my code much smaller in number lines. Is there any view which supports the above behavior.

– amadamala Mar 28 at 19:05.

I'm not sure I understand what the problem is. You wrote "Once the touch event was completed ..." - does that mean you've got it to work in one situation but not others? Are you considering that the touch event is completed when the action of the MotionEvent is MotionEvent.

ACTION_UP? If you've got that part working, then why not just re-use that same code for the action MotionEvent. ACTION_MOVE?

I'm using MotionEvent. Action_UP in my code. I have ImageButton's in table layout in layout xml file.

One of the ImageButton's is always invisible. When the right ImageButton was touched and dragged into the empty cell, I'm making the target ImageButton as visible and the one I just dragged as invisible. I'm trying to implement the Fifteen puzzle(en.wikipedia.Org/wiki/Fifteen_puzzle) game.

– amadamala Mar 28 at 14:23.

Define a own view wich is extending imagebutton, define a drawable for "active" state and set (or reset) the drawable onclick.

I have ImageButton's in table layout in layout xml file. One of the ImageButton's is always invisible. When the right ImageButton was touched and dragged into the empty cell, I'm making the target ImageButton as visible and the one I just dragged as invisible.

I'm trying to implement the Fifteen puzzle(en.wikipedia.Org/wiki/Fifteen_puzzle) game. – amadamala Mar 28 at 14:23.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions