[android-developers] Re: TextView resets its location after an animation
The answer is that it needs to have animation.setFillAfter( true ); in order to persist the animation after its end. Strange that this is not true by default. On Sep 17, 3:09 pm, ClarkBattle wrote: > Ive tried several interpolators and many different values. It always > resets. RELATIVE_TO_PARENT is not appropriate for this app. I have a > small textView that just needs to shrink to a small strip on the side > of the screen when swiped, exposing another text view below it. > Thanks though. > > On Sep 17, 12:55 pm, "Tommy" wrote: > > > I haven't worked to much with animations but the ones I have that slide in > > from the right look like this: > > > Animation inFromRight = new TranslateAnimation( > > Animation.RELATIVE_TO_PARENT, +1.0f, > > Animation.RELATIVE_TO_PARENT, 0.0f, > > Animation.RELATIVE_TO_PARENT, 0.0f, > > Animation.RELATIVE_TO_PARENT, 0.0f > > ); > > inFromRight.setDuration(600); > > inFromRight.setInterpolator(new > > AccelerateInterpolator()); > > > maybe try to copy and paste that into your app and see if it changes > > anything. They look almost the same to me except for some numbers and > > AccelerateInterpolator that I use. Let me know if it works if you > > copy/paste it. > > > Tommy > > > Android Mobile Phone Application Developer > > Database Administrator > > .net Web Specialist > > > -Original Message- > > From: android-developers@googlegroups.com > > > [mailto:android-develop...@googlegroups.com] On Behalf Of ClarkBattle > > Sent: Friday, September 17, 2010 3:37 PM > > To: Android Developers > > Subject: [android-developers] TextView resets its location after an > > animation > > > I am using a Translate animation on a text view. > > > TranslateAnimation animation = new > > TranslateAnimation( > > TranslateAnimation.RELATIVE_TO_SELF, 0.0f, > > TranslateAnimation.RELATIVE_TO_SELF, 0.8f, > > TranslateAnimation.RELATIVE_TO_SELF, 0f, > > TranslateAnimation.RELATIVE_TO_SELF, 0f ); > > > animation.setDuration( ANIMATION_DURATION ); > > animation.setInterpolator( new > > DecelerateInterpolator() ); > > > myTextView.startAnimation( animation ); > > > This works in that it slides the text view to the right. However, > > when the animation is complete it puts the text view right back where > > it started! I was under the impression tat the view should remain > > where the animation left it. Why does this happen? > > > Thanks > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group > > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: TextView resets its location after an animation
The answer is that it needs to have animation.setFillAfter( true ); in order to persist the animation after its end. Strange that this is not true by default. On Sep 17, 3:09 pm, ClarkBattle wrote: > Ive tried several interpolators and many different values. It always > resets. RELATIVE_TO_PARENT is not appropriate for this app. I have a > small textView that just needs to shrink to a small strip on the side > of the screen when swiped, exposing another text view below it. > Thanks though. > > On Sep 17, 12:55 pm, "Tommy" wrote: > > > I haven't worked to much with animations but the ones I have that slide in > > from the right look like this: > > > Animation inFromRight = new TranslateAnimation( > > Animation.RELATIVE_TO_PARENT, +1.0f, > > Animation.RELATIVE_TO_PARENT, 0.0f, > > Animation.RELATIVE_TO_PARENT, 0.0f, > > Animation.RELATIVE_TO_PARENT, 0.0f > > ); > > inFromRight.setDuration(600); > > inFromRight.setInterpolator(new > > AccelerateInterpolator()); > > > maybe try to copy and paste that into your app and see if it changes > > anything. They look almost the same to me except for some numbers and > > AccelerateInterpolator that I use. Let me know if it works if you > > copy/paste it. > > > Tommy > > > Android Mobile Phone Application Developer > > Database Administrator > > .net Web Specialist > > > -Original Message- > > From: android-developers@googlegroups.com > > > [mailto:android-develop...@googlegroups.com] On Behalf Of ClarkBattle > > Sent: Friday, September 17, 2010 3:37 PM > > To: Android Developers > > Subject: [android-developers] TextView resets its location after an > > animation > > > I am using a Translate animation on a text view. > > > TranslateAnimation animation = new > > TranslateAnimation( > > TranslateAnimation.RELATIVE_TO_SELF, 0.0f, > > TranslateAnimation.RELATIVE_TO_SELF, 0.8f, > > TranslateAnimation.RELATIVE_TO_SELF, 0f, > > TranslateAnimation.RELATIVE_TO_SELF, 0f ); > > > animation.setDuration( ANIMATION_DURATION ); > > animation.setInterpolator( new > > DecelerateInterpolator() ); > > > myTextView.startAnimation( animation ); > > > This works in that it slides the text view to the right. However, > > when the animation is complete it puts the text view right back where > > it started! I was under the impression tat the view should remain > > where the animation left it. Why does this happen? > > > Thanks > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com > > For more options, visit this group > > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: TextView resets its location after an animation
Ive tried several interpolators and many different values. It always resets. RELATIVE_TO_PARENT is not appropriate for this app. I have a small textView that just needs to shrink to a small strip on the side of the screen when swiped, exposing another text view below it. Thanks though. On Sep 17, 12:55 pm, "Tommy" wrote: > I haven't worked to much with animations but the ones I have that slide in > from the right look like this: > > Animation inFromRight = new TranslateAnimation( > Animation.RELATIVE_TO_PARENT, +1.0f, > Animation.RELATIVE_TO_PARENT, 0.0f, > Animation.RELATIVE_TO_PARENT, 0.0f, > Animation.RELATIVE_TO_PARENT, 0.0f > ); > inFromRight.setDuration(600); > inFromRight.setInterpolator(new > AccelerateInterpolator()); > > maybe try to copy and paste that into your app and see if it changes > anything. They look almost the same to me except for some numbers and > AccelerateInterpolator that I use. Let me know if it works if you > copy/paste it. > > Tommy > > Android Mobile Phone Application Developer > Database Administrator > .net Web Specialist > > -Original Message- > From: android-developers@googlegroups.com > > [mailto:android-develop...@googlegroups.com] On Behalf Of ClarkBattle > Sent: Friday, September 17, 2010 3:37 PM > To: Android Developers > Subject: [android-developers] TextView resets its location after an > animation > > I am using a Translate animation on a text view. > > TranslateAnimation animation = new > TranslateAnimation( > TranslateAnimation.RELATIVE_TO_SELF, 0.0f, > TranslateAnimation.RELATIVE_TO_SELF, 0.8f, > TranslateAnimation.RELATIVE_TO_SELF, 0f, > TranslateAnimation.RELATIVE_TO_SELF, 0f ); > > animation.setDuration( ANIMATION_DURATION ); > animation.setInterpolator( new > DecelerateInterpolator() ); > > myTextView.startAnimation( animation ); > > This works in that it slides the text view to the right. However, > when the animation is complete it puts the text view right back where > it started! I was under the impression tat the view should remain > where the animation left it. Why does this happen? > > Thanks > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en