android - 动画结束后无法激活查看触摸事件

标签 android animation view

我在按钮上添加动画,使用 .SetFillAfter(true) 来保持屏幕上的最后一个 View 。但是我发现不能再通过触摸屏幕上的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);

最佳答案

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

@Ruivo - 通过查看动画的源代码,我发现了这个:

/** 
 * 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

关于android - 动画结束后无法激活查看触摸事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2871951/

相关文章:

Android编程,如何改变语音频率

javascript - 动画与IE文字阴影冲突

wpf - 使用 wpf VisualStateManager 动画可见性和不透明度

sql - 如果我更新 View ,我的原始表会更新吗

asp.net-mvc - 您可以从 MVC 3 中的强类型模型中删除 HTML 字段前缀吗?

java - 如何从 fragment 调用 Activity 方法?

android - 如何在 Android 中为数据库编写可重用代码

jquery - 多个同步动画的多个级联

android - 动态添加的 View 在 Android 的方向上消失

java - Android序列化-java反序列化