1 findViewById(R.id.btnTranslateMe).setOnClickListener(new View.OnClickListener() {
2 @Override
3 public void onClick(View arg0) {
4 arg0.startAnimation(AnimationUtils.loadAnimation(MainActivity.this, R.anim.ta));
5 }
6 });
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 fromXDelta,fromYDelta 起始时X,Y座标,屏幕右下角的座标是X:320,Y:480
4 toXDelta, toYDelta 动画结束时X,Y的座标
5 duration 持续时间
6 -->
7 <translate xmlns:android="http://schemas.android.com/apk/res/android"
8 android:fromXDelta="0"
9 android:toXDelta="200"
10 android:fromYDelta="0"
11 android:toYDelta="200"
12 android:duration="1000" >
13 </translate>