gpt4 book ai didi

android - 如何在 WizarDroid 中跳过 WizardStep

转载 作者:行者123 更新时间:2023-11-29 01:40:48 28 4
gpt4 key购买 nike

我使用 WizarDroid,如果满足某些条件,我打算跳过一个步骤。

我有以下流程:

flow = new WizardFlow.Builder()
.setActivity(this) //First, set the hosting activity for the wizard
.setContainerId(R.id.step_container) //then set the layout container for the steps.
.addStep(WStep1.class) //Add your steps in the order you want them
.addStep(WStep2.class) //to appear and eventually call create()
.addStep(WStep3.class) //to create the wizard flow.
.create();

如果设置了变量,我打算跳过 WStep2。

根据它的教程,我只能禁用前进到下一步,直到我这样设置:Controlling wizard flow dynamically

如何告诉向导可以跳过下一步?

最佳答案

WizarDroid 似乎没有提供从 WizardFlow 中删除步骤的功能。

但是,您可以检查您在 WStep2 中提到的那个变量,然后调用 goNext()。这肯定会奏效。

如果你想尝试另一种方式,你也可以使用(虽然我不能保证它会起作用):

setStepCompleted(1, true) //setStepCompleted(int stepPosition, boolean stepCompleted)

编辑:看到你也想在向导中倒退,你将不得不拆分向导。

我的意思是,如果您想在某些情况下跳过 WStep3:

在你的 MainActivity.class 中

flow1 = new WizardFlow.Builder()
.setActivity(this)
.setContainerId(R.id.step_container)
.addStep(WStep1.class)
.addStep(WStep2.class)
.create();

在 WStep2.class 中

if (skipWStep3()){
flow2 = new WizardFlow.Builder()
.setActivity(this)
.setContainerId(R.id.step_container)
.addStep(WStep4.class)
.addStep(WStep5.class)
.create();
}
else {
flow2 = new WizardFlow.Builder()
.setActivity(this)
.setContainerId(R.id.step_container)
.addStep(WStep3.class)
.addStep(WStep4.class)
.addStep(WStep5.class)
.create();
}

关于android - 如何在 WizarDroid 中跳过 WizardStep,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24822966/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com