0
我該如何實現這一目標?在片段上動態切換視圖
否視圖表示...
@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();
}