android开发 imageview或者imagebutton 实现移动效果

android开发 imageview或者imagebutton 实现移动效果
将res\layout\main.xml中的TextView取代为ImageView;
在res下创建新的文件夹anim,并在此文件夹下面定义Animation XML文件;
修改OnCreate()中的代码,显示动画资源;
关键代码,解析如下:
//main.xml中的ImageView
ImageView start = (ImageView) findViewById(R.id.start);
//加载动画
Animation fly = AnimationUtils.loadAnimation(this, R.anim.fly);
start.startAnimation(fly);


fly.xml中的代码:
       android:shareInterpolator="false">

/>


特别要注意的是:xml中的0位置,就是main.xml中imageview的原始位置。

你可能感兴趣的:(android开发,android,imagebutton,imageview,Animation)