2013-04-24 78 views
2

我有一個PopupWindow我用PopupWindow.setAnimationStyle();兩個popupwindows之間swop。 swoping和動畫的作品。但是當我將x值從0縮放到1或1到0時,它會閃爍。如何停止我的縮放動畫中的閃爍?

例如,該閃爍:

<?xml version="1.0" encoding="utf-8"?> 
<set 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/accelerate_decelerate_interpolator" 
    android:duration="300" > 
    <scale 
     android:pivotX="50%" 
     android:fromXScale="1" android:toXScale="0" 
     android:fromYScale="1" android:toYScale="1" /> 
</set> 

但這不會:

<?xml version="1.0" encoding="utf-8"?> 
<set 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/accelerate_decelerate_interpolator" 
    android:duration="300" > 
    <scale 
     android:pivotX="50%" 
     android:fromXScale="0.9" android:toXScale="0.1" 
     android:fromYScale="1" android:toYScale="1" /> 
</set> 

爲什麼這會閃爍,我如何讓它不忽悠?

這可能是我的設備,但我必須使它不閃爍在此設備上。 我有一個三星Galaxy Tab 2 10.1

回答

0

嘗試增加與最小值的延遲屬性,

android:startOffset="1" 

這意味着動畫會更快,可以減少閃爍。像,

<scale 
     android:pivotX="50%" 
     android:fromXScale="0.9" android:toXScale="0.1" 
     android:fromYScale="1" android:toYScale="1" 
     android:startOffset="1"/> 

還要檢查this post說,啓用硬件加速,它並沒有爲我工作,但我可以通過調整延遲和持續時間值,以解決這一問題。您的pivotY屬性的價值是什麼?

希望這會有所幫助,如果您已經解決了問題,請分享解決方案。