tags:

views:

19

answers:

1

Hi,

I would like to know how I can move a small image on the screen. The user clicks for instance a small block and after that I would like to slide it over the screen.

Any help is appreciated,

Thanks in advance Jasper

A: 

You just need to create a TranslationAnimation and apply it. Should look something like this:

mButton.setOnClickListener(new View.OnClickListener()
{
    @Override
    public void onClick(View view)
    {
        TranslateAnimation slide = new TranslateAnimation(0.0f, 1.0f, 0.0f, 1.0f);
        view.startAnimation(slide);
    }
});

Here is a link to the info on TranslateAnimation

CaseyB
Thanks very much.Jasper
jdekeij