3

I add animation on a Button, use .SetFillAfter(true) to keep the last view on screen. But I find it impossible to call touch event function by touching Button icon on the screen any more (but it can be called by touching original position).

<?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);
Christopher Orr
  • 110,418
  • 27
  • 198
  • 193
Lenny
  • 31
  • 3

1 Answers1

0

Also looking for a solution to this problem.

@Ruivo - Looking through the source for Animation I found this:

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

Update: I provided my own answer to this problem. See this question Android ScaleAnimation doesn't scale clickable area

Community
  • 1
  • 1
gyoda
  • 1,053
  • 2
  • 11
  • 22