相关疑难解决方法(0)

Android动画闪烁

我一直在搜索关于这个主题的线索,我可以在Android 2.2处理AnimationListeners时出现的闪烁中找到,但我无法解决我的问题.

我得到的是一个LinearLayout'popover',用户触摸向下移动大约100个像素,然后再触摸它以将其向上移动.我终于让它在没有任何闪烁的第一部分上工作(感谢建议在动画视图上调用clearAnimation()),但是当做相反的操作时(即,将视图向上移动),有一个闪烁开始.我无法在onAnimationStart()方法中调用clearAnimation(),因为它不会动画!

当然,如果我使用setFillAfter()而没有任何动画监听器,所有动画都能完美地工作,但是视图的触摸区域不会移动(因为视图本身没有"实际"移动).

任何帮助将不胜感激.

this.popoverTab.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        popoverTab.setClickable(false);
        popoverTab.setFocusable(false);
        if (popoverHidden) {
            Log.d(TAG, "About to show popover");
            // the popover is currently hidden, show it.
            TranslateAnimation animation = new TranslateAnimation(0, 0, 100, 0);
            animation.setDuration(700);
            animation.setFillBefore(true);
            animation.setAnimationListener(new AnimationListener() {
                public void onAnimationEnd(Animation animation) {

                }

                public void onAnimationRepeat(Animation animation) {

                }

                public void onAnimationStart(Animation animation) {
                    footer.layout(footer.getLeft(), (footer.getTop() - 100), footer.getRight(), footer.getBottom());
                }
            });
            footer.startAnimation(animation);
        } else {
            Log.d(TAG, "About to hide popover");
            // the …
Run Code Online (Sandbox Code Playgroud)

android android-animation

16
推荐指数
3
解决办法
2万
查看次数

标签 统计

android ×1

android-animation ×1