Initially, ImageView is completely transparent 0.0, I attach the effect of animation of transparency to it, but the value of the alpha channel of transparency does not increase.

And if initially ImageView is made not transparent, that is, when the alpha channel is equal to 255 or (float) 1.0, then everything works well.

How to do what would initially ImageView was transparent, and then gradually became opaque.

<alpha android:duration="300" android:fromAlpha="0.2" android:startOffset="0" android:toAlpha="0.6" > </alpha> <scale android:startOffset="0" android:duration="600" android:fromXScale="1.0" android:fromYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:toXScale="30.0" android:toYScale="30.0" /> <alpha android:duration="300" android:fromAlpha="0.6" android:startOffset="300" android:toAlpha="0.0" > </alpha> 

    2 answers 2

    Before playing the animation, set your imageView setVisibility(View.INVISIBLE) . After scrolling the animation, call View.VISIBLE

    UPD

    You can still try this:

      <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:fillAfter="true" android:fillEnabled="true" android:alpha=".0"/> 

    It turns out completely transparent object. But these parameters

     android:fillAfter="true" android:fillEnabled="true" 

    in theory, they must guarantee the preservation of the View state after the animation. Need to check

    • Androyd Androyd I thought so to do. And how else? It turns out that in the super-slow state the following algorithm is formed: 1. the object appears on the whole screen 2. we make it completely transparent. 3. Increase its opacity by increasing the alpha channel values. And I would like this algorithm: 1. A completely transparent object appears 2. we increase its opacity, increasing the values ​​of the alpha channel. - user22940
    • updated the answer, check - Android Android
    • Androyd Androyd does not want to work. The object is just transparent, that's all. - user22940
    • Hmm, strange. But I am sure that we need to dig in this direction - Android Android
    • @semiromid you can make it invisible by the ImageView.setVisibility (View.INVISIBLE) method before adding a picture in the ImageView, then even in a super-duper slowed down state it will not be seen that something has appeared there. - BORSHEVIK

    Here is an XML appearance animation file, 100% working

     <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false" > <alpha android:duration="1000" android:fromAlpha="0.0" android:toAlpha="1.0" > </alpha> </set> 
    • 100%?) And if you make the object being animated initially transparent? That will not work just like that. You have to adjust the alpha animation of the object itself, that is, set setAlpha = 1.0 before the beginning of the animation. But I don’t do it in such a way because I initially asked my question. - user22940
    • @semiromid How? Are you talking about SetVisibility? - BORSHEVIK Nov.
    • BORSHEVIK in my cases SetVisibility does not fit. I edited my comment above, please see it. - user22940
    • @semiromid I seem to understand you. You mean that your picture is initially transparent, i.e. she has the Alpha parameter. If you are aware of this, then you need to try not Animation, but ObjectAnimation, their difference is that Animation serves only for visual effects, and ObjectAnimation also changes the properties of the object. But this method will not help if you set the transparency in color, i.e. The first 2 characters in the Color parameter, only if they changed the special paragraph Alpha - BORSHEVIK
    • BORSHEVIK Wow! Interesting! I'll try now! - user22940