NineOldAndroids在level 11以下的版本中实现view动画

NineOldAndroids项目: http://nineoldandroids.com/

在level 11以上的系统版本中,可以用以下方法实现view平移、透明度

text1.setTranslationX(-600 * arg1);
		text1.setAlpha(1 - Math.abs(arg1));
		text2.setTranslationX(-200 * arg1);
		text2.setAlpha(1 - Math.abs(arg1));
		text3.setTranslationX(-400 * arg1);
		text3.setAlpha(1 - Math.abs(arg1));
但是这些方法不能在level 11以下的版本中使用,所有为了解决这个问题,可以引用NineOldAndroids来实现同样的效果
ViewPropertyAnimator.animate(text1).setDuration(0).translationX(-600*arg1);
		ViewPropertyAnimator.animate(text2).setDuration(0).translationX(-200*arg1);
		ViewPropertyAnimator.animate(text3).setDuration(0).translationX(-400*arg1);
		ViewPropertyAnimator.animate(text1).setDuration(0).alpha(1 - Math.abs(arg1));
		ViewPropertyAnimator.animate(text2).setDuration(0).alpha(1 - Math.abs(arg1));
		ViewPropertyAnimator.animate(text3).setDuration(0).alpha(1 - Math.abs(arg1));

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。