效果图:
使用方法:
Step 1
implementation 'com.wang.avi:library:2.1.3'
Step 2
添加这个Ui到你的布局 androdi:visibility最好设置为“gone”
简单用法:
<com.wang.avi.AVLoadingIndicatorView android:layout_width="wrap_content" android:layout_height="wrap_content" app:indicatorName="BallPulseIndicator" />
高级用法:
<com.wang.avi.AVLoadingIndicatorView android:id="@+id/avi" android:layout_width="wrap_content" //or your custom size android:layout_height="wrap_content" //or your custom size style="@style/AVLoadingIndicatorView"// or AVLoadingIndicatorView.Large or AVLoadingIndicatorView.Small android:visibility="visible" //visible or gone app:indicatorName="BallPulseIndicator"//Indicator Name app:indicatorColor="your color" />
Step 3:
代码中调用:
void startAnim(){ avi.show(); // or avi.smoothToShow(); } void stopAnim(){ avi.hide(); // or avi.smoothToHide(); }
详细见原Github:https://github.com/81813780/AVLoadingIndicatorView