Android编程实现仿iphone抖动效果的方法(附源码下载)

2019-12-10 19:52:50于海丽

代码:

 

 
  1. package com.android.shake;  import android.app.Activity; 
  2. import android.os.Bundle;  import android.util.DisplayMetrics; 
  3. import android.view.animation.Animation;  import android.view.animation.Animation.AnimationListener; 
  4. import android.view.animation.RotateAnimation;  import android.widget.TextView; 
  5. import android.view.View;  import android.view.Window; 
  6. public class ShakeTestActivity extends Activity implements View.OnClickListener {  private TextView mtv0; 
  7. private TextView mtv1;  private TextView mtv2; 
  8. private TextView mtv3;  private TextView mtv4; 
  9. private TextView mtv5;  private TextView mtv6; 
  10. private TextView mtv7;  private TextView mtv8; 
  11. private TextView mtv9;  private TextView mtv10; 
  12. private TextView mtv11;  private TextView mtv12; 
  13. private TextView mtv13;  private TextView mtv14; 
  14. private TextView mtv15;  private TextView mtv16; 
  15. private TextView mtv17;  private TextView mtv18; 
  16. private TextView mtv19;  private boolean mNeedShake = false; 
  17. private boolean mStartShake = false;  private static final int ICON_WIDTH = 80; 
  18. private static final int ICON_HEIGHT = 94;  private static final float DEGREE_0 = 1.8f;