欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  技术分享

Recyclerview下拉刷新_Ultimate下拉刷新动画开源框架

程序员文章站 2022-02-14 11:21:05
...

分享一个Android的下拉刷新的Demo、注意:这不是一般的下拉刷新效果、是带有很炫酷的动画的刷新效果、Demo是用的Recyclerview做为刷新的内容的承载、当你下拉的时候、Demo中包括一系列添加Item、删除Item等动画效果、还有异步的刷新等功能、非常强大的一个Demo、下面是部分效果图片

Recyclerview下拉刷新_Ultimate下拉刷新动画开源框架


所有动画列表枚举

enum Type {
    FadeIn(new FadeInAnimator(new OvershootInterpolator(1f))),
    FadeInDown(new FadeInDownAnimator(new OvershootInterpolator(1f))),
    FadeInUp(new FadeInUpAnimator(new OvershootInterpolator(1f))),
    FadeInLeft(new FadeInLeftAnimator(new OvershootInterpolator(1f))),
    FadeInRight(new FadeInRightAnimator(new OvershootInterpolator(1f))),
    Landing(new LandingAnimator(new OvershootInterpolator(1f))),
    ScaleIn(new ScaleInAnimator(new OvershootInterpolator(1f))),
    ScaleInTop(new ScaleInTopAnimator(new OvershootInterpolator(1f))),
    ScaleInBottom(new ScaleInBottomAnimator(new OvershootInterpolator(1f))),
    ScaleInLeft(new ScaleInLeftAnimator(new OvershootInterpolator(1f))),
    ScaleInRight(new ScaleInRightAnimator(new OvershootInterpolator(1f))),
    FlipInTopX(new FlipInTopXAnimator(new OvershootInterpolator(1f))),
    FlipInBottomX(new FlipInBottomXAnimator(new OvershootInterpolator(1f))),
    FlipInLeftY(new FlipInLeftYAnimator(new OvershootInterpolator(1f))),
    FlipInRightY(new FlipInRightYAnimator(new OvershootInterpolator(1f))),
    SlideInLeft(new SlideInLeftAnimator(new OvershootInterpolator(1f))),
    SlideInRight(new SlideInRightAnimator(new OvershootInterpolator(1f))),
    SlideInDown(new SlideInDownAnimator(new OvershootInterpolator(1f))),
    SlideInUp(new SlideInUpAnimator(new OvershootInterpolator(1f))),
    OvershootInRight(new OvershootInRightAnimator(1.0f)),
    OvershootInLeft(new OvershootInLeftAnimator(1.0f));

    private BaseItemAnimator mAnimator;

    Type(BaseItemAnimator animator) {
        mAnimator = animator;
    }

    public BaseItemAnimator getAnimator() {
        return mAnimator;
    }
}


xml引用方式

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".loadmoredemo.BasicFunctions">

    <android.support.v7.widget.Toolbar
        android:id="@ id/tool_bar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="#30f2e0"
        app:contentInsetEnd="0dp"
        app:contentInsetLeft="0dp"
        app:contentInsetRight="0dp"
        app:contentInsetStart="0dp">

        <include layout="@layout/toolbar_loadmore" />

    </android.support.v7.widget.Toolbar>

    <com.marshalchen.ultimaterecyclerview.UltimateRecyclerView
        android:id="@ id/ultimate_recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="?attr/actionBarSize"
        app:recyclerviewClipToPadding="true"
        app:recyclerviewDefaultSwipeColor="@array/google_colors"
        app:recyclerviewFloatingActionView="@layout/floating_view"
        app:recyclerviewScrollbars="vertical" />
</FrameLayout>


recyclerview 下拉刷新动画源代码下载链接: recyclerview开源框架 密码: n8tk