首页 > 代码库 > NineOldAndroids在level 11以下的版本中实现view动画
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));
NineOldAndroids在level 11以下的版本中实现view动画
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。