so my screen has an image view which I dragged down the screen with animation using this code:
float bottomOfScreen = context.getResources().getDisplayMetrics()
.heightPixels - (myImageView.getHeight() * 2);
myImageView.animate()
.translationY(bottomOfScreen)
.setDuration(durationOfFalling);
so basically, I had an image and it was dragged down and out of the screen and now my image has disappeared but I need it to come back to the same place that it was before I dragged it down (at the top of the screen) so I can drag it down again whenever I want. Do you have any solutions as to how I can make the image appear again at the top of the screen so I can re-use it?
I also tried adding it through ConstraintLayout and then constraintLayout.addView(myImageView) like that (and probably did it wrong):
ConstraintLayout ly = findViewById(R.id.ly);
noteiv1.setLayoutParams(new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.WRAP_CONTENT, ConstraintLayout.LayoutParams.WRAP_CONTENT));
noteiv1.setId(View.generateViewId());
ly.addView(noteiv1);
ConstraintSet set = new ConstraintSet();
set.clone(ly);
set.connect(noteiv1.getId(), ConstraintSet.LEFT, ly.getId(), ConstraintSet.LEFT);
set.connect(noteiv1.getId(), ConstraintSet.RIGHT, ly.getId(), ConstraintSet.RIGHT);
set.connect(noteiv1.getId(), ConstraintSet.TOP, ly.getId(), ConstraintSet.TOP);
set.connect(noteiv1.getId(), ConstraintSet.BOTTOM, ly.getId(), ConstraintSet.BOTTOM);
set.applyTo(ly);
*noteiv1 is the image view I need to re-use
I'd be glad for some help :)