Android按钮样式(dmytrodanylyk)使用

1.添加依赖

dependencies {
compile ‘com.github.dmytrodanylyk.android-process-button:library:1.0.4’
}
项目地址
https://github.com/dmytrodanylyk/android-process-button

2.Action Process Button

操作指南
https://github.com/dmytrodanylyk/android-process-button/wiki/User-Guide#action-process-button
xml布局:



custom:pb_colorComplete="@color/green_complete"会报错的话参考
xmlns:custom=“http://schemas.android.com/apk/res-auto”
例如:


        
        custom:pb_colorComplete
        
        custom:pb_textComplete
        
        custom:pb_colorProgress
        
        custom:pb_textProgress
        
        custom:pb_textError="Error"
        
        custom:pb_colorComplete

通过Java代码控制它

ActionProcessButton btnSignIn = (ActionProcessButton) findViewById(R.id.btnSignIn);
btnSignIn.setMode(ActionProcessButton.Mode.PROGRESS);

//有进度的进度条
// no progress
button.setProgress(0);
// progressDrawable cover 50% of button width, progressText is shown
button.setProgress(50);
// progressDrawable cover 75% of button width, progressText is shown
button.setProgress(75);
// completeColor & completeText is shown
button.setProgress(100);

//显示无尽进度条
btnSignIn.setMode(ActionProcessButton.Mode.ENDLESS);
// 设置进度> 0以启动进度指示器动画
button.setProgress(1);

还有更多参考用户指南(转)
https://github.com/dmytrodanylyk/android-process-button/wiki/User-Guide#action-process-button

你可能感兴趣的:(Android)