一、动画分类
Android 动画一共分为4类
TranslateAnimation - 移动位置
AlphaAnimation - 透明度渐变
RotateAnimation - 旋转
ScaleAnimation - 大小渐变
二、移动动画效果图
三、移动动画源码
private ImageView mImageView;
private TranslateAnimation mTranslateLeft;
private TranslateAnimation mTranslateRight;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 供移动ImageView
mImageView = (ImageView) findViewById(R.id.imageview);
// 两个按钮
Button leftButton = (Button) findViewById(R.id.left_button);
leftButton.setOnClickListener(this);
Button rightButton = (Button) findViewById(R.id.right_button);
rightButton.setOnClickListener(this);
// 指定移动位置
mTranslat