Ich habe Animation:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<alpha
android:fromAlpha="0.2"
android:toAlpha="1.0"
android:duration="500"/>
</set>
und ImageView:
<ImageView
android:id="@+id/listViewIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/settings"
android:alpha="0.2"/>
und Code:
final Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
final ImageView iv = (ImageView) findViewById(R.id.listViewIcon);
anim .setFillAfter(true);
iv.startAnimation(anim);
Also am Anfang habe ich ImageViewmit Alpha 0.2und am Ende möchte ich ImageViewmit Alpha haben 1. Aber so funktioniert es nicht - wenn die Animation beginnt, wird mehr Alpha hinzugefügt und die Animation endet mit Alpha0.2
Was muss ich ändern, um mein Bild von 0.2bis zu animieren 1?
Ich habe mit verschiedenen Einstellungen überprüft - ich gesetzt android:alpha="1.0", fromAlpa="1.0", toAlpha="0.2"funktioniert es wie ich erwartet hatte - von Alpha 1zu 0.2. Es sieht so aus, als würde Alpha von ImageViewmit Alpha von Animation multipliziert ...
fillAfterAttribut: developer.android.com/reference/android/view/animation/…