自定义Button实现button点击缩放动画效果
<span style="font-family:SimSun;font-size:14px;">package com.example.mydemo.scalebutton;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import com.example.mydemo.R;
public class ScaleButton extends Button {
private Context context;
public ScaleButton(Context context) {
this(context, null);
this.context = context;
}
public ScaleButton(Context context, AttributeSet attrs) {
this(context, attrs, 0);
this.context = context;
}
public ScaleButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onTouchEvent(MotionEvent