我有動畫的Android動畫阿爾法
<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>
和ImageView的
<ImageView
android:id="@+id/listViewIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/settings"
android:alpha="0.2"/>
和代碼:
final Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
final ImageView iv = (ImageView) findViewById(R.id.listViewIcon);
anim .setFillAfter(true);
iv.startAnimation(anim);
所以一開始我有阿爾法0.2,並在ImageView的結束我想要AlphaView的ImageView。但它不這樣工作 - 當動畫開始更多的Alpha添加和動畫finis h with alpha 0.2
我必須改變以使圖像從0.2-> 1變爲動畫?
我檢查了不同的設置 - 我設置了android:alpha =「1.0」,從alpa =「1.0」toAlpha =「0.2」它像我期望的那樣工作 - 從alpha 1到0.2。它看起來像從ImageView的阿爾法是從動畫阿爾法乘...
爲防止視圖在最後跳回到0.2 alpha,請使用'fillAfter'屬性:http://developer.android.com/reference/android/view/animation/Animation.html#attr_android:fillAfter – Jave
事實並非如此。阿爾法不會去1.當我從1-> 0.2動畫,它工作正常,並保持在0.2(我使用填充後)。當我想從0.2到1進行動畫時,它會消失到接近0並且達到0.2 – wioskamala
您是否已將fillEnabled設置爲true? – Jave