zoukankan      html  css  js  c++  java
  • lottie动画实战(仿汽车之家,BOSS直聘APP底部Tab切换动画)

    GitHub地址:https://github.com/kongpf8848/Animation

    效果如下:

      

     主要是自定义View继承LottieAnimationView并实现Checkable接口,代码如下:

    import android.content.Context;
    import android.util.AttributeSet;
    import android.widget.Checkable;
    
    import com.airbnb.lottie.LottieAnimationView;
    
    public class AnimationRadioView extends LottieAnimationView implements Checkable {
    
        private boolean checked;
    
        public AnimationRadioView(Context context) {
            this(context, null);
        }
    
        public AnimationRadioView(Context context, AttributeSet attrs) {
            this(context, attrs, 0);
        }
    
        public AnimationRadioView(Context context, AttributeSet attrs, int defStyleAttr) {
            super(context, attrs, defStyleAttr);
        }
    
    
        @Override
        public boolean isChecked() {
            return this.checked;
        }
    
        @Override
        public void setChecked(boolean checked) {
    
            try {
                if (this.checked != checked) {
                    this.checked = checked;
                    if (isAnimating()) {
                        cancelAnimation();
                    }
                    if (checked) {
                        if (getSpeed() < 0.0F) {
                            reverseAnimationSpeed();
                        }
                        playAnimation();
                    } else {
                        if (getSpeed() > 0.0F) {
                            reverseAnimationSpeed();
                        }
                        playAnimation();
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    
        @Override
        public void toggle() {
            setChecked(!this.checked);
        }
    }
  • 相关阅读:
    mysql 远程登陆不上
    hdu 5339 Untitled【搜索】
    SqlServer 书目
    passwordauthentication yes
    oracle 11g RAC ocfs2
    Oracle 11g RAC database on ASM, ACFS or OCFS2
    CentOS ips bonding
    Oracle 11g RAC features
    openStack 王者归来之 trivial matters
    openstack windows 2008 img
  • 原文地址:https://www.cnblogs.com/rainboy2010/p/12660412.html
Copyright © 2011-2022 走看看