昨天qq该小组被要求类别似QQ聊天窗口是如何实现的抖动效果。在这里,我只是意识到了什么,贴上代码:

<span style="font-family:Courier New;">                final View decorView = ((ViewGroup) findViewById(android.R.id.content)).getChildAt(0);

		Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
		vibrator.vibrate(new long[] { 200, 100, 200, 100 }, 3);

		TranslateAnimation translateAnimation = new TranslateAnimation(50, 150,200, 50);
		translateAnimation.setDuration(2000);
		Interpolator interpolator = new CycleInterpolator(5);
		translateAnimation.setInterpolator(interpolator);
		decorView.startAnimation(translateAnimation);</span>

是的,就这么简单

相关文章:

  • 2021-11-07
  • 2022-01-17
  • 2021-05-30
  • 2021-07-07
  • 2022-02-15
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-30
  • 2021-05-14
  • 2022-12-23
  • 2021-04-05
  • 2021-04-24
  • 2022-01-11
  • 2022-12-23
相关资源
相似解决方案