下面是出现泄漏的代码片段,help!
private void initTurntalbeAnim() { final View v = mTurntableLayout; final float centerX = mContext.getResources().getDimension(R.dimen.turntable_width_anim) / 2; final float centerY = mContext.getResources().getDimension(R.dimen.turntable_height_anim) / 2; mTurntableAnim = ValueAnimator.ofFloat(0, 360f); mTurntableAnim.setDuration(6000); mTurntableAnim.setRepeatCount(ValueAnimator.INFINITE); mTurntableAnim.setInterpolator(new LinearInterpolator()); v.setPivotX(centerX); v.setPivotY(centerY); mTurntableAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { //出现内存泄漏代码 mTurntableLayout.setRotation((Float) animation.getAnimatedValue()); } }); }
解决方案
13
不是有一个翻转的属性的动画吗?用那个 试试
12
rotateanimation 可以试下这个类哦。