https://github.com/samlss/daynightloadingview
🌜☀🌝A loading view that switches between day and night.
https://github.com/samlss/daynightloadingview
android loadingview
Last synced: 11 months ago
JSON representation
🌜☀🌝A loading view that switches between day and night.
- Host: GitHub
- URL: https://github.com/samlss/daynightloadingview
- Owner: samlss
- License: mit
- Created: 2018-07-30T07:35:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T02:11:47.000Z (over 7 years ago)
- Last Synced: 2025-04-08T11:37:56.902Z (about 1 year ago)
- Topics: android, loadingview
- Language: Java
- Homepage:
- Size: 1.56 MB
- Stars: 10
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DayNightLoadingView
A day night loading view(一个日夜切换的loading view).
[](https://github.com/samlss/SignalLoadingView) [](https://github.com/samlss/DayNightLoadingView/blob/master/LICENSE) [](https://blog.csdn.net/Samlss)
* [中文](#%E4%B8%AD%E6%96%87)
* [English](#english)
* [License](#license)

---
## 中文
### 使用
在根目录的build.gradle添加这一句代码:
```
allprojects {
repositories {
//...
maven { url 'https://jitpack.io' }
}
}
```
在app目录下的build.gradle添加依赖使用:
```
dependencies {
implementation 'com.github.samlss:DayNightLoadingView:1.1'
}
```
布局中使用:
```
```
代码中使用:
```
dayNightLoadingView.resume(); //恢复动画
dayNightLoadingView.pause(); //暂停动画
dayNightLoadingView.stop(); //停止和释放动画,可在activity销毁时调用
```
属性说明:
| 属性 | 说明 |
| ------------- |:-------------:|
| background_color | 背景颜色 |
| sun_color | 太阳颜色 |
| sunshine_color | 阳光颜色 |
| moon_color | 月亮颜色 |
| star_color | 星星颜色 |
由于使用了Animator和AnimaterSet的resume和pause方法,因此api要求为 >= 19,如果你想兼容更低的api,
方法有:
- 不调用该库的resume和pause接口,最低可兼容到api12
- 你自己修改代码
- 联系我,等我有时间的时候尽量完善一下
---
## English
### Use
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:DayNightLoadingView:1.1'
}
```
in layout.xml:
```
```
in java code:
```
dayNightLoadingView.resume(); //resume animator
dayNightLoadingView.pause(); //pause animator
dayNightLoadingView.stop(); //Stop and release the animation, can be called when the activity is destroyed
```
Attributes description:
| attr | description |
| ------------- |:-------------:|
| background_color | the background color |
| sun_color | the sun color |
| sunshine_color | the sunshine color |
| moon_color | the moon color |
| star_color | the stars color |
Due to use of the resume and pause methods of Animator and AnimalSet, the api requirement is >= 19,
if you want to be compatible with lower apis,
the methods are:
- Do not call the resume and pause method of this library, the minimum compatible with api 12.
- Modify the code by yourself.
- Contact me, i will try to improve it when I have time.
[id]: http://example.com/ "Optional Title Here"
---
## [LICENSE](https://github.com/samlss/DayNightLoadingView/blob/master/LICENSE)