听起来此库存在一个错误:https://github.com/shivasurya/materialsteppers
错误如下:例如,如果我们在步骤2中,然后单击下一步,则将调用步骤4的oncreate而不是步骤3的oncreate。当我们单击next时,next的oncreate或oncreateview都不会片段被调用。下一个片段的哪个方法被调用?
有人遇到同样的问题吗?
public class ExampleActivity extends ProgressMobileStepper {
List<Class> stepperFragmentList = new ArrayList<>();
@Override
public List<Class> init() {
stepperFragmentList.add(Step1Fragment.class);
stepperFragmentList.add(Step2Fragment.class);
stepperFragmentList.add(Step3Fragment.class);
stepperFragmentList.add(Step4Fragment.class);
stepperFragmentList.add(Step5Fragment.class);
return stepperFragmentList;
}
}
片段1:
public class Step1Fragment extends StepperFragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public boolean onNextButtonHandler() {
return true;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return view;
}
}
片段2
public class Step2Fragment extends StepperFragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public boolean onNextButtonHandler() {
return true;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return view;
}
}
片段3:
public class Step3Fragment extends StepperFragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public boolean onNextButtonHandler() {
return true;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return view;
}
}
片段4:
public class Step4Fragment extends StepperFragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public boolean onNextButtonHandler() {
return true;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return view;
}
}
片段5:
public class Step5Fragment extends StepperFragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public boolean onNextButtonHandler() {
return true;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return view;
}
}