1,在加载数据的时候我们往往会提示用户加载中,也就是加载动画:
一下是加载动画的Loading:
先看效果:
使用也是非常的简单:
直接添加依赖:
dependencies {
compile 'com.wang.avi:library:2.1.3'
}
然后就是编写布局文件:
<com.wang.avi.AVLoadingIndicatorView android:layout_width="wrap_content" android:layout_height="wrap_content" app:indicatorName="BallPulseIndicator" />在代码中:
avLoadingIndicatorView= (AVLoadingIndicatorView) findViewById(R.id.load); avLoadingIndicatorView.setIndicator("CubeTransitionIndicator");设置loading样式Loading样式的种类:
"BallPulseIndicator",
"BallGridPulseIndicator",
"BallClipRotateIndicator",
"BallClipRotatePulseIndicator",
"SquareSpinIndicator",
"BallClipRotateMultipleIndicator",
"BallPulseRiseIndicator",
"BallRotateIndicator",
"CubeTransitionIndicator",
"BallZigZagIndicator",
"BallZigZagDeflectIndicator",
"BallTrianglePathIndicator",
"BallScaleIndicator",
"LineScaleIndicator",
"LineScalePartyIndicator",
"BallScaleMultipleIndicator",
"BallPulseSyncIndicator",
"BallBeatIndicator",
"LineScalePulseOutIndicator",
"LineScalePulseOutRapidIndicator",
"BallScaleRippleIndicator",
"BallScaleRippleMultipleIndicator",
"BallSpinFadeLoaderIndicator",
"LineSpinFadeLoaderIndicator",
"TriangleSkewSpinIndicator",
"PacmanIndicator",
"BallGridBeatIndicator",
"SemiCircleSpinIndicator",
"com.wang.avi.sample.MyCustomIndicator"
样式顺序对照图片顺序
控制显示隐藏:
avi.hide();隐藏
avi.show();显示
大神Demo https://github.com/81813780/AVLoadingIndicatorView