我有下一個RotateAnimation
。RotateAnimation滯後ImageView後面的alpha值爲
private RotateAnimation createImageRotatingAnimationInfinite(ImageView imageView) {
RotateAnimation animation = new RotateAnimation(0f, 360f, imageView.getWidth()/2, imageView.getHeight()/2);
animation.setFillAfter(true);
animation.setInterpolator(new LinearInterpolator());
animation.setRepeatCount(Animation.INFINITE);
animation.setDuration(ROTATE_DURATION);
return animation;
}
而接下來的佈局:
...
<!--ROTATING BACKGROUND-->
<com.bipfun.nightlight.customviews.SquareHImageView
android:id="@+id/a_main_rotating_bckgnd"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="@drawable/rotating_bckgnd_default"/>
<!--LIGHT BACKGROUND-->
<ImageView
android:id="@+id/a_main_light_bckgnd"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:scaleType="centerCrop"
android:src="@drawable/bckgnd_stars_light"/>
...
我的動畫設置爲a_main_rotating_bckgnd
,當我向上/ donwards在屏幕上移動查找器我修改的a_main_light_bckgnd
的alpha
值。事情是,任何alpha > 0
,它後面的旋轉背景落後於瘋狂。它只發生在一些設備上,如HTC One,三星S3,三星Note II。
API與4.1.2,4.3和4.4.2不同。它不能像其他具有類似API的設備一樣使用API。他們都已經得到了xhdpi
屏幕,但我已經嘗試過與小圖像的背景,他們仍然滯後。
我似乎無法弄清楚這一點。我需要在前面的圖像,因爲它需要一個位圖。我也有一個簡單的View
,我將背景色設置爲#50000000
(對於alpha爲50),但似乎不影響旋轉動畫。
任何想法如何解決這個問題?
我犯了類似的錯誤。我在mdpi中有一個png。我在做這個圖像的視圖的縮放和alpha動畫。當我將png移到xxxhdpi時,動畫變得平滑。 – black