ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
昨天在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> ~~~ 是的,就是这么简单