ButtonProgressBar
介绍:
一个带状态显示的下载按钮。
运行效果:
使用说明:
1.Add this in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
2.Add this dependency in your app level build.gradle:
dependencies {
compile 'com.github.ishaan1995:ButtonProgressBar:1.0'
}
XML file:
<github.ishaan.buttonprogressbar.ButtonProgressBar
android:id="@+id/bpb_main"
app:text="Upload"
app:textColor="@android:color/white"
app:type="indeterminate"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
java:
final ButtonProgressBar bar = (ButtonProgressBar) findViewById(R.id.bpb_main);
bar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bar.startLoader();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
bar.stopLoader();
}
}, 5000);
}
});
已下载
0