A signal rotation loading view(一个信号旋转loading view).
在根目录的build.gradle添加这一句代码:
allprojects {
repositories {
//...
maven { url 'https://jitpack.io' }
}
}
在app目录下的build.gradle添加依赖使用:
dependencies {
implementation 'com.github.samlss:SignalLoadingView:1.1'
}
布局中使用:
<com.iigo.library.SignalLoadingView
android:id="@+id/slv_loading1"
android:layout_width="100dp"
android:layout_height="100dp"
app:duration="1500"
app:interpolator="LinearInterpolator"
app:signal_color="#fbc02d" />
代码中使用:
signalLoadingView.start(); //开始动画
signalLoadingView.stop(); //结束动画
signalLoadingView.setInterpolator(new LinearInterpolator());//设置动画插值器
signalLoadingView.setSignalColor(Color.RED);//设置信号颜色
signalLoadingView.setDuration(500); //设置动画执行时间
属性说明:
属性 | 说明 |
---|---|
signal_color | 信号颜色 |
duration | 动画时间 |
interpolator | 动画加速器 |
- AccelerateDecelerateInterpolator
- AccelerateInterpolator
- DecelerateInterpolator
- BounceInterpolator
- CycleInterpolator
- LinearInterpolator
- AnticipateOvershootInterpolator
- AnticipateInterpolator
- OvershootInterpolator
如果不能满足你的需要,你可以下载源码自行修改。
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
//...
maven { url 'https://jitpack.io' }
}
}
Add it in your app build.gradle at the end of repositories:
dependencies {
implementation 'com.github.samlss:SignalLoadingView:1.1'
}
in layout.xml:
<com.iigo.library.SignalLoadingView
android:id="@+id/slv_loading1"
android:layout_width="100dp"
android:layout_height="100dp"
app:duration="1500"
app:interpolator="LinearInterpolator"
app:signal_color="#fbc02d" />
in java code:
signalLoadingView.start(); //start animation
signalLoadingView.stop(); //stop animation
signalLoadingView.setInterpolator(new LinearInterpolator());//set the animator interpolator
signalLoadingView.setSignalColor(Color.RED);//set the signal color
signalLoadingView.setDuration(500); //set the animator duration
Attributes description:
attr | description |
---|---|
signal_color | the signal color |
duration | the animator duration |
interpolator | the animator interpolator |
- AccelerateDecelerateInterpolator
- AccelerateInterpolator
- DecelerateInterpolator
- BounceInterpolator
- CycleInterpolator
- LinearInterpolator
- AnticipateOvershootInterpolator
- AnticipateInterpolator
- OvershootInterpolator
If you can not meet your needs, you can download the source code to modify it.