第三方小动画——用来网络加载前使用

来源:互联网 发布:python 改变当前路径 编辑:程序博客网 时间:2024/05/17 07:47

依赖

  compile 'com.wang.avi:library:2.1.3'

布局文件(相对布局居中)

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    xmlns:app="http://schemas.android.com/apk/res-auto"    >    <com.wang.avi.AVLoadingIndicatorView        android:id="@+id/avi"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_centerInParent="true"        app:indicatorColor="?attr/colorPrimary"        app:indicatorName="BallSpinFadeLoaderIndicator"/>    <!--网络加载布局展示 -->    <com.jcodecraeer.xrecyclerview.XRecyclerView        android:layout_width="match_parent"        android:id="@+id/xrecy"        android:layout_height="match_parent">    </com.jcodecraeer.xrecyclerview.XRecyclerView></RelativeLayout>

进入视图加载数据前 开始动画
      avi.smoothToShow();
网络请求成功后 结束动画
     if(avi.isShown()){                avi.smoothToHide();            }




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