【问题标题】:Cannot activate View Touch Event After Animation end动画结束后无法激活 View Touch 事件
【发布时间】:2010-05-20 08:03:37
【问题描述】:

我在 Button 上添加动画,使用 .SetFillAfter(true) 将最后一个视图保留在屏幕上。但是我发现通过触摸屏幕上的Button图标已经无法调用触摸事件功能了(但可以通过触摸原始位置来调用)。

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<Button
    android:id ="@+id/button"  
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Move"
    />
</AbsoluteLayout>

  anim = AnimationUtils.loadAnimation(this, R.anim.move);
  anim.setInterpolator(this, android.R.anim.accelerate_decelerate_interpolator);

【问题讨论】:

    标签: android animation view


    【解决方案1】:

    也在寻找解决这个问题的方法。

    @Ruivo - 查看 Animation 的源代码,我发现了这个:

    /** 
     * Indicates whether or not this animation will affect the transformation
     * matrix. For instance, a fade animation will not affect the matrix whereas
     * a scale animation will.</p>
     *
     * @return true if this animation will change the transformation matrix
     */
    public boolean willChangeTransformationMatrix() {
        // assume we will change the matrix
        return true;
    }
    
    /**
     * <p>Indicates whether or not this animation will affect the bounds of the
     * animated view. For instance, a fade animation will not affect the bounds
     * whereas a 200% scale animation will.</p>
     *
     * @return true if this animation will change the view's bounds
     */
    public boolean willChangeBounds() {
        // assume we will change the bounds
        return true;
    }
    

    更新:我为这个问题提供了自己的答案。看到这个问题Android ScaleAnimation doesn't scale clickable area

    【讨论】:

      猜你喜欢
      • 2022-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      • 2018-04-20
      • 1970-01-01
      相关资源
      最近更新 更多