Android弹性进度条更新:ElasticProgressBar
jopen
9年前
弹性进度条,是为Android做了一个加载条。
Elastic Progress Bar , is a loading bar made for Android , the initial design is https://github.com/Tibolte/ElasticDownload , I applied some changes to make it accessible to everyone!
USAGE
Elastic Progress Bar is pushed to JCenter, so you just need to add the following dependency to yourbuild.gradle.
compile 'it.michelelacorte.elasticprogressbar:library:1.0.4'
In alternative you can use AAR repository with:
allprojects { repositories { maven { url "https://dl.bintray.com/michelelacorte/maven/" } jcenter() mavenCentral() } }
And add this dependecies
compile 'it.michelelacorte.elasticprogressbar:library:1.0.4@aar'
In youlayout.xml
<it.michelelacorte.elasticprogressbar.ElasticDownloadView android:id="@+id/elastic_download_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerInParent="true"/>
Then in yourMainActivity.java
ElasticDownloadView mElasticDownloadView; mElasticDownloadView = (ElasticDownloadView)findViewById(R.id.elastic_download_view); //Call startIntro() to start animation mElasticDownloadView.startIntro(); //You can set progress mElasticDownloadView.setProgress(10); //If is finish animation mElasticDownloadView.success(); //Or fail //mElasticDownloadView.fail();
You can set color background with (default iscolorPrimary), make sure to call this beforesetContentView(..)of your activity:
OptionView.setBackgroundColorSquare(int color)
For setnoBackgrounddo this (withoutsetBackgroundColorSquare, remembersetBackgroundColorSquareis priority thannoBackground
OptionView.noBackground = true;
SYSTEM REQUIREMENT
Android API 11+