刷新头布局 帧动画的实现

第一步、

//导入依赖

compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.1'
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.1'//如果使用了特殊的Header
第二步、

<animation-list
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
    <!-- 静态图片 -->

    <item android:drawable="@drawable/header_dropdown_refresh_1"
        android:duration="00"></item>
    <item android:drawable="@drawable/header_dropdown_refresh_2"
        android:duration="100"></item>
    <item android:drawable="@drawable/header_dropdown_refresh_3"
        android:duration="100"></item>
    <item android:drawable="@drawable/header_dropdown_refresh_4"
        android:duration="100"></item>
</animation-list>


第三步、

//        头布局帧动画

        drawable = (AnimationDrawable) getResources().getDrawable(R.drawable.refresh_header);
        zhenImage.setBackgroundDrawable(drawable);
        storySmart.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(RefreshLayout refreshlayout) {
                drawable.start();
                storySmart.finishRefresh(2000);
            }
        });

猜你喜欢

转载自blog.csdn.net/qq_38875767/article/details/78457972