How to move and disappear any view with animation

Ok, so I have a View where it animates with the following code:

RelativeLayout rl = (RelativeLayout) findViewById(R.id.productPage_parentLayout_RL); ImageView iv = new ImageView( ProductPage.this ); imageLoader.DisplayImage(FULL_PRODUCT_INFO.getFirstImage(), iv); Animation animation = new TranslateAnimation(0, helper.getDeviceWidth() - 100,0, 0); animation.setDuration(1000); animation.setFillAfter(true); rl.addView(iv); 

With this code, the view starts on the left side of the screen and moves almost to the end of the screen, but I also want to fade the view and hide / destroy it at the end. I tried to find anything related to this, but could not find.

Any help is appreciated.

+4
source share
3 answers

Using the files that http://nineoldandroids.com/ , I solved this problem.

+2
source

try it

 ObjectAnimator move=ObjectAnimator.ofFloat(iv, "translationY",100f); move.setDuration(3000); ObjectAnimator alpha1=ObjectAnimator.ofFloat(iv, "alpha",0.5f); alpha1.setDuration(1000); ObjectAnimator alpha2=ObjectAnimator.ofFloat(iv, "alpha",0); alpha2.setDuration(2000); AnimatorSet animset=new AnimatorSet(); animset.play(alpha2).before(alpha1).with(move); animset.start(); 
+6
source
  Animation a = new AlphaAnimation(1.0f, 0.0f); a.setDuration(1000); a.setFillAfter(true); iv.startAnimation(a); AnimationSet set = new AnimationSet(true); set.addAnimation(animation) set.addAnimation(a) set.setFillAfter(true); iv.startAnimation(set); set.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub } public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } public void onAnimationEnd(Animation animation) { iv.setVisibility(View.INVISIBLE); } }); 
+2
source

All Articles