2013-04-24 79 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属性的价值是什么?

希望这会有所帮助,如果您已经解决了问题,请分享解决方案。