lundi 13 avril 2015

How can I swap the position of two or more images?

How can I change the position of these ImageViews by giving them the position of another? (Swapping them around in Slow Motion)



blue = (ImageView) findViewById(R.id.imageB);
red = (ImageView) findViewById(R.id.imageR);
Green = (ImageView) findViewById(R.id.imageG);
int x = blue.getLeft();
int y = blue.getTop();

int x1 = red.getLeft();
int y1 = red.getTop();

int x2 = Green.getLeft();
int y2 = Green.getTop();


Green.setLeft(x);
Green.setTop(y);

blue.setLeft(x1);
blue.setTop(y1);

red.setLeft(x2);
red.setTop(y2);`

Aucun commentaire:

Enregistrer un commentaire