I have an ImageView element that I create in my code and place inside my RelativeLayout. I set this image as invisible in order to start using the following code:
arrow.setVisibility(View.INVISIBLE);
Then I defined the Fade-In Alpha animation via XML:
<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false" android:fillEnabled="true" android:fillAfter="true" android:fillBefore="true"> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:startOffset="100" android:duration="300" /> /set>
To start the animation:
I just call the following to start the animation
myview.startAnimation(myanimation);
The problem I see is that my animation causes the ImageView to flicker when fully visible, and then go through the alpha animation from 0 to 1. How can I fix this? I cannot set the initial value of the alpha value to 0, because the alpha animation is based on percentages, not absolute alpha value. (for example: 0 * current value up to 1 * current value)
Any help would be greatly appreciated.
android animation android-animation fadein
Derek gebhard
source share