Android收藏集安卓Android实战

Android LoadView,一款可以自定义动画的加载库

2018-07-03  本文已影响148人  HeLe小子拽

LoadView

android loadview是一个可以灵活自定义并且可以结合第三方动画解耦的库,使用起来也是超级方便

演示

暂无

项目地址

https://github.com/gyf-dev/LoadView

使用

android studio

implementation 'com.gyf.loadview:loadview:1.0.0'

用法

简单用法

  <com.gyf.loadview.LoadView
      android:id="@+id/load_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent" />

在xml中自定义loading样式

   <com.gyf.loadview.LoadView
       android:id="@+id/load_view"
       android:layout_width="match_parent"
       android:layout_height="match_parent">
   
       <!--自定义loading动画,可以自定义为任何控件,也支持第三方动画库-->
       <ProgressBar
           android:layout_width="wrap_content"
           android:layout_height="wrap_content" />
   </com.gyf.loadview.LoadView>

在java中自定义loading样式

   loadView.setLoadingView(new ProgressBar(this));

或者

     loadView.setLoadingView(R.layut.你的布局id);
   LoadView loadView = new LoadView(this);
   addView(loadView);

高级用法

   LoadManager.getInstance().setEmpty("空的数据",R.mipmap.empty)  //自定义加载为空,展示的样式
                   .setFail("失败了",R.mipmap.fail);  //自定义加载失败,展示的样式

混淆

上一篇 下一篇

猜你喜欢

热点阅读