private AnimatorSet morphParent(int duration){
GradientDrawable drawable=GradientDrawable.class.cast(parent.getBackground());
int endValue=isFolded?getResources().getDimensionPixelOffset(R.dimen.morph_radius):0;
ObjectAnimator cornerAnimation = ObjectAnimator.ofFloat(drawable, "cornerRadius", endValue);
endValue=isFolded?parent.getHeight()/2:parent.getHeight()*2;
ValueAnimator heightAnimation = ValueAnimator.ofInt(parent.getHeight(),endValue);
heightAnimation.addUpdateListener(valueAnimator-> {
int val = (Integer) valueAnimator.getAnimatedValue();
ViewGroup.LayoutParams layoutParams = parent.getLayoutParams();
layoutParams.height = val;
parent.setLayoutParams(layoutParams);
});
cornerAnimation.setDuration(duration);
heightAnimation.setDuration(duration);
AnimatorSet set=new AnimatorSet();
set.playTogether(cornerAnimation,heightAnimation);
return set;
}
DotsFragment.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:Material-Motion
作者:
评论列表
文章目录