DotsFragment.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:Material-Motion 作者:
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;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号