zoukankan      html  css  js  c++  java
  • 安卓高级 特效动画ExplosionField和 SmoothTransition

    本教程所有图片为github上的所无法正常访问请科学上网

    SmoothTransition

    展示效果
    这里写图片描述

    这里写图片描述

    这里写图片描述

    github:源码地址

    使用方法

    你能通过一行代码使用上面所有的动画

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        new SwitchAnimationUtil().startAnimation(getWindow().getDecorView(), Constant.mType);
    }

    如果你希望动画使用在 ListView / GridView 或者其他的 AdapterView可以按照如下方法:

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (mSwitchAnimationUtil == null) {
            mSwitchAnimationUtil = new SwitchAnimationUtil();
            mSwitchAnimationUtil.startAnimation(mList, Constant.mType);
        }
    }

    如果你想在Fragment使用动画:

    class DemoFragment extends Fragment { private View mConverView;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle     savedInstanceState) {
        mConverView = LayoutInflater.from(getActivity()).inflate(R.layout.view_fragment, null);
        mConverView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
    
            @Override
            public void onGlobalLayout() {
                new SwitchAnimationUtil().startAnimation(mConverView, Constant.mType);
            }
        });
    
        return mConverView;
    }
    }

    你能添加依赖到你项目中使用

    ExplosionField

    git地址:项目源码

    效果:
    这里写图片描述

    使用方法:带入依赖后

    ExplosionField mExplosionField = ExplosionField.attach2Window(Context);
       mExplosionField.explode(view);

    附送一个国内作者使用此效果做的登陆界面

  • 相关阅读:
    go语言goroutine
    go语言接口
    go语言的map
    go语言切片
    go语言数组
    django的信号机制
    python redis 实现简单的消息订阅
    scrapy中使用selenium来爬取页面
    尝试用tornado部署django
    控制台输出太多导致项目启动过慢
  • 原文地址:https://www.cnblogs.com/muyuge/p/6152120.html
Copyright © 2011-2022 走看看