抖动的输入框

Java代码:启动动画



1. Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);  
2.         findViewById(R.id.pw).startAnimation(shake);

anim/shake.xml



1. <translate xmlns:android="http://schemas.android.com/apk/res/android"  
2. android:duration="5000"  
3. android:fromXDelta="0"  
4. android:interpolator="@anim/cycle_7"  
5. android:toXDelta="10" />


duration为抖动时间,fromXDelta,toXDelta抖动幅度

anim/cycle_7.xml


1. <cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"  
2. android:cycles="50" />



main.xml





    1. <EditText android:id="@+id/pw"  
    2. android:layout_width="match_parent"  
    3. android:layout_height="wrap_content"  
    4. android:layout_margin="50dip"  
    5. android:clickable="true"  
    6. android:singleLine="true"  
    7. android:password="true"  
    8. />  
    9.