I have a ViewFlipper with two ImageView widgets. I have set the in and out animation as android.R.anim.slide_in_left and android.R.anim.slide_out_right
Now when the two ImageViews have two different drawables, then the animation is sleek and smooth. But when I set the both the ImageViews to the same Drawable, the screen flickers. Why is this happening and how do I prevent it?
I think you might want to use Drawable.mutate() to prevent the drawable from being reused. :-)
Related
I came across this solution: How can I scale textviews using shared element transitions?
But this is not working, when I use this solution, I don't get any animations at all.
The problem is the size of the text inside textviews, and the color of the text. They don't get animated and the movement animation looks really weird. Should I make a animation that runs after the SharedContentTransitions have completed? Or is there a fix that makes this issue a whole lot easier to fix?
So I have multiple very long images (like 2000x100) that i want to have scrolling across the screen at different speeds. and my original solution is not working out. Originally, I placed them all in a HorizontalScrollView, and made a runnable that used setPadding to adjust the position of the ImageViews within the scrollView. This works, however, the background that is supposed to remain mostly stationary on the screen, shakes back and forth as you scroll, and lags behind the scroll location significantly. It's choppy and it looks bad.
Is there any other way that I can move images across the screen to achieve the desired effect?
(could I perhaps use a frame layout, and set an ontouchlistener? then how would you move the layout across the screen?)
I set up a layout so that the images protrude off of the right of the screen correctly, but I can't seem to move them off of the left of the screen (setpadding(-50,0,0,0) does not work)
Thanks in advance!
I solved this by using relative layouts within a frame layout. I set an ontouchlistener for the frame layout and used the scrollTo method for each image with a modifying coefficient. I had not previously noticed the scrollTo and scrollBy methods of the layout.
How can I use a ViewFlipper correctly?
A have a layout file, with a ViewFlipper. I included 7 layouts in there.
Using this code:
mFlipper = (ViewFlipper) ((Activity) mycontext).findViewById(R.id.flipper);
mFlipper.setInAnimation(AnimationUtils.loadAnimation(mycontext, R.anim.slide_left_in));
mFlipper.setOutAnimation(AnimationUtils.loadAnimation(mycontext, R.anim.slide_left_out));
mFlipper.setDrawingCacheEnabled(true);
and then:
mFlipper.setDisplayedChild(viewID);
but it is very slow, and laggy. sometimes it runs fast, but more time it is laggy and slow. why?
update: all of my layout's background picture is a big texture background with FILL_PARENT and transparent png.
Probably because
all of my layout's background picture is a big texture background with FILL_PARENT and transparent png.
Try to remove that background image from all those inner layouts and set it to the root one (ViewFlipper?).
What is the best way in android to make animation for image transition between images?
what is the best way to re-size the image to fit the screen?
thanks to all
use viewflipper. maybe not the best but it really works if you wanna customize animation in view transition.
set the image as the background of imageview or some layout.
I'm using a ViewFlipper with two ListViews. When setting a background drawable on the ViewFlipper, the animation performed when "flipping" only renders the foreground, and background is black! When animation is done, the background appears.
Is there a known problem with animating the background "layer" of a view?
Also, the animation performance/frame rate on my HTC Hero decreases significantly when adding the background.
Any ideas or solutions? Thanks!
/Morten
I have the same problem and I found the following workaround. You have to set the background on the view being animated, not on the flipper. So for consistency, this would mean you have to set the same background on all the top level views contained in your flipper.