[android-developers] Unexpected behavior with animated views / layouts
I am using a button to trigger an animation of a view. This button toggles the view, such that the view slides on and off the screen... Class Members: final Animation animout = AnimationUtils.loadAnimation(this, R.anim.slideout ); final Animation animin = AnimationUtils.loadAnimation(this, R.anim.slidein ); Click handler for the button: public void onClick(View v) { View sv = findViewById(R.id.SV); if(mDialIsIn) { sv.clearAnimation(); sv.startAnimation(animout); mDialIsIn = false; } else { sv.clearAnimation(); sv.startAnimation(animin); mDialIsIn = true; } } So... it works... but... This view that is moving around has a handler for the touch event. The strange thing is... when my view is off screen, it is still getting touch events for its original position on screen. It seems the animation is only moving the visual aspect of the view (drawing surface) and not the rest of the view's guts. Does this make sense? Do I just need to manually turn off my handling of the touch event while the view is animated off screen? And... My intention was to put other controls UNDER this view. If this view is on top receiving touch events even when off screen, will controls underneath get their events? Or... do I have to do something about the Z order when the view is scrolled off screen? Am I just going about this all wrong? Thanks, Buzz -- 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
Re: [android-developers] Unexpected behavior with animated views / layouts
On Sun, Feb 27, 2011 at 2:29 PM, BuzzB buzz.burro...@gmail.com wrote: The strange thing is... when my view is off screen, it is still getting touch events for its original position on screen. It seems the animation is only moving the visual aspect of the view (drawing surface) and not the rest of the view's guts. Does this make sense? Yes, AFAIK, that's how it works (I haven't actually used Animations yet). Animations make it look like the views are doing something, they're not actually doing anything. You need to update the layout once the view is done animating to make stick. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
Re: [android-developers] Unexpected behavior with animated views / layouts
The views definentally don't update when you want them too, and it does this to save cpu, there is something in the documention that updates the view, im not sure if it will work with this. But you probably should disable the button when it is off screen. On Mar 2, 2011 10:59 PM, TreKing treking...@gmail.com wrote: On Sun, Feb 27, 2011 at 2:29 PM, BuzzB buzz.burro...@gmail.com wrote: The strange thing is... when my view is off screen, it is still getting touch events for its original position on screen. It seems the animation is only moving the visual aspect of the view (drawing surface) and not the rest of the view's guts. Does this make sense? Yes, AFAIK, that's how it works (I haven't actually used Animations yet). Animations make it look like the views are doing something, they're not actually doing anything. You need to update the layout once the view is done animating to make stick. - TreKing - Chicago transit tracking app for Android-powered devices -- 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 -- 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