刷新头布局 帧动画的实现

来源:互联网 发布:win10手写识别软件 编辑:程序博客网 时间:2024/06/08 12:33

第一步、

//导入依赖

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);            }        });

阅读全文
0 0
原创粉丝点击