NineOldAndroids在level 11如下的版本中實現view動畫

NineOldAndroids項目: http://nineoldandroids.com/ java

在level 11以上的系統版本中,能夠用如下方法實現view平移、透明度 android

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));
相關文章
相關標籤/搜索