我如何实现这一目标?没有显示任何观点......
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.details, container, false);
InitAlerts();
return v;
}
private void InitAlerts()
{
//TODO Find step number
//Temp: already set to 1
if(stepNum == 1) {
startStepOne();
} else if(stepNum == 2) {
startStepTwo();
} else {
startStepSummary();
}
}
private void startStepOne() {
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
View v = inflater.inflate( R.layout.usage_alerts_step_one, null, false);
alertsStepOneConfirm = (Button) v.findViewById(R.id.alertsStepOneConfirm);
alertsStepOneConfirm.setOnClickListener(this);
v.bringToFront();
}
private void startStepTwo() {
LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
View v = inflater.inflate( R.layout.usage_alerts_step_two, null, false);
stepTwoConfirm = (Button) v.findViewById(R.id.stepTwoConfirm);
stepTwoConfirm.setOnClickListener(this);
v.bringToFront();
}
答案 0 :(得分:1)
1)使用相应的步骤视图作为参数调用R.layout.details布局上的addView方法。您需要从每个步骤*方法返回膨胀的视图。
2)如果你不需要R.layout.details,你可以让onCreateView返回与步骤对应的视图