一个带圆点进度显示的按钮 模仿windows效果
There are four status in LoadingButton
- Normal ----> 1
- Process ----> 2 ~ 99
- Complete ----> 100
- Error ----> -1
<com.teresazl.library.impl.LoadingButton
android:id="@+id/loading_btn_normal"
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="Send"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="18sp"
app:complete_text="DONE" />
// normal
normalBtn = (LoadingButton) findViewById(R.id.loading_btn_normal);
normalBtn.setOnLoadCompleteListener(this);
normalBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
...
}
});
// complete
completeBtn = (LoadingButton) findViewById(R.id.loading_btn_complete);
completeBtn.setProgress(100);
// error
errorBtn = (LoadingButton) findViewById(R.id.loading_btn_error);
errorBtn.setProgress(-1);
// process
processBtn = (LoadingButton) findViewById(R.id.loading_btn_process);
processBtn.setProgress(50);
public class MainActivity extends AppCompatActivity implements ProcessButton.LoadingListener {
....
....
normalBtn.setOnLoadingListener(this);
@Override
public void loadComplete() {
Toast.makeText(this, "complete", Toast.LENGTH_SHORT).show();
}
@Override
public void loadError() {
Toast.makeText(this, "error", Toast.LENGTH_SHORT).show();
}
}
If you like this project, please star me
If you have any questions, please email me: teresazl@yeah.net