📅  最后修改于: 2023-12-03 14:59:27.921000             🧑  作者: Mango
Baoyachi StepView is a customizable and easy to use step view library for Android. It provides a step-by-step progress indicator that can be used in wizards, forms, or any other multi-step process of an application.
To use Baoyachi StepView, add the following dependency to your app's build.gradle file:
implementation 'com.baoyachi:stepview:1.3.1'
Add StepView
to your layout XML file:
<com.baoyachi.stepview.HorizontalStepView
android:id="@+id/step_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Customize your step view in the activity or fragment:
HorizontalStepView mStepView = findViewById(R.id.step_view);
List<String> steps = Arrays.asList("Step 1", "Step 2", "Step 3");
mStepView.setSteps(steps)
.setStepViewTexts(steps)
.setTextSize(16)
.setStepsViewIndicatorCompletedLineColor(ContextCompat.getColor(this, android.R.color.white))
.setStepsViewIndicatorUnCompletedLineColor(ContextCompat.getColor(this, R.color.uncompleted_text_color))
.setStepViewComplectedTextColor(ContextCompat.getColor(this, android.R.color.white))
.setStepViewUnComplectedTextColor(ContextCompat.getColor(this, R.color.uncompleted_text_color))
.setStepsViewIndicatorCompleteIcon(ContextCompat.getDrawable(this, R.drawable.ic_check_black_24dp))
.setStepsViewIndicatorDefaultIcon(ContextCompat.getDrawable(this, R.drawable.ic_radio_button_unchecked_black_24dp))
.setStepsViewIndicatorAttentionIcon(ContextCompat.getDrawable(this, R.drawable.ic_attention));
Update the step view programmatically:
// move to the next step
mStepView.go(1, true);
// move to the previous step
mStepView.go(1, false);
// jump to a specific step
mStepView.setCurrentStep(2);
Baoyachi StepView is a versatile and customizable step indicator library that can be used in a wide variety of applications. Its simplicity of use and easy installation make it an attractive choice for developers looking for a step view implementation.