几句代码如下:
Java代码 Animation animation = AnimationUtils.loadAnimation(this, R.anim.shake);   

  EditText editText = (EditText) findViewById(R.id.edittext);   

     editText.startAnimation(animation);  

Animation animation = AnimationUtils.loadAnimation(this, R.anim.shake);
EditText editText = (EditText) findViewById(R.id.edittext);
	 editText.startAnimation(animation);


shake.xml:
里面面的fromXDelta,toXDelta是表示x轴方向的移动距离
Java代码

<translate xmlns:android="http://schemas.android.com/apk/res/android"  

    android:fromXDelta="0" android:toXDelta="30" android:duration="1000"  

    android:interpolator="@anim/cycle_interpolator" />  

<translate xmlns:android="http://schemas.android.com/apk/res/android"
	android:fromXDelta="0" android:toXDelta="30" android:duration="1000"
	android:interpolator="@anim/cycle_interpolator" />


cycleInterpolator.xml文件:
Java代码
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"  

    android:cycles="3" />  

posted on 2011-04-14 17:12  kitea  阅读(126)  评论(0)    收藏  举报