Android Animation Flicker
I had the same problem and after few days I found the solution ... thanx to:
http://www.mail-archive.com/android-developers@googlegroups.com/msg67535.html
I figured out a solution to this problem. The clue came from the fact
that when showing the view, everything worked fine.
Apparently, when the animation is running, the update that would be
forced by the show happens in the background and doesn't cause the
flicker. Adding a short animation to the back end of the
onAnimationEnd() when we are hiding the view makes the flicker go
away.Here is the new onAndimationEnd() in the working code
public void onAnimationEnd(Animation animation) {
animation = new TranslateAnimation(0.0f, 0.0f, 0.0f, 0.0f);
animation.setDuration(1);
mPlayer0Panel.startAnimation(animation);
}
View blinks after animation
I solved problem of blinking of the view by animating it on other way. I used following strategy. First of all I used Guideline
component of the ConstraintLayout
. I constraint my banner to the top of it and place parameter layout_constraintGuide_begin = "0dp"
. After that I used ValueAnimator
in order to get animated value for my Guideline
and changed the guidebegin
params of it(see the code).
val params: ConstraintLayout.LayoutParams = guideline2.layoutParams as ConstraintLayout.LayoutParams
animBanner = ValueAnimator.ofInt(0, banner.height + toolbar.height)
animBanner!!.addUpdateListener {
params.guideBegin = it.getAnimatedValue() as Int
guideline2.layoutParams = params
}
This is the declaration of animation. At the end it is enough to use animBanner.start()
for starting the animation and animBanner.reverse()
for reverse animation (hiding banner).
Android animation flickers
call this as the first statement in OnAnimationEnd
theViewOnToWhichAnimationIsApplied.clearAnimation();
this should fix it as it solved mine. i did face the same
Flickering(Blinking) screen when using Shared elements animation to change between activities
Removing the finish() method solved the issue. Apparently it would destroy the activity during the animation causing it to vanish.
Related Topics
Howto Do a Simple Ftp Get File on Android
Change Background Popupmenu in Android
How to Hide App Title in Android
Provide the Caller Id for Incoming Call from My Own App
Getting Net::Err_Unknown_Url_Scheme While Calling Telephone Number from HTML Page in Android
How to Update Google Play Services for Android Studio 2.2 Emulators
Fragment Must Be a Public Static Class to Be Properly Recreated from Instance State
Black Screen Before Splash Screen Appear in Android
How to Create a Date and Time Picker in Android
Permission Denial: Not Allowed to Send Broadcast in Android
What Is Metadata ? and What Is The Use of It in Android
Security "Crypto" Provider Deprecated in Android N
How to Create Ripple Effect in Simple Layout
How to Keep The Oauth Consumer Secret Safe, and How to React When It's Compromised
How to Implement Search in Customlistview Based on Class Item of Pojo Class in Android