Achieve results
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/6B/wKioL1Wb7BTgiA7zAAB4ukFeR6w306.jpg "style=" float: none; "title=" Implementation effect 1 "alt=" wkiol1wb7btgia7zaab4ukfer6w306.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/6F/wKiom1Wb6kawF0wYAABk6jjZGUQ785.jpg "style=" float: none; "title=" Implementation Effect 2 "alt=" Wkiom1wb6kawf0wyaabk6jjzguq785.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/6B/wKioL1Wb7BTDMB1SAABdRshN8RU953.jpg "style=" float: none; "title=" Implementation Effect 3 "alt=" Wkiol1wb7btdmb1saabdrshn8ru953.jpg "/>
2. Realization of the step-outs
Main activity Layout
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/6F/wKiom1Wb6kbjZiZqAAAugXXkH40818.jpg "style=" float: none; "title=" Activity fixed layout "alt=" Wkiom1wb6kbjzizqaaaugxxkh40818.jpg "/>
Import com.chencheng.meituan.fragment.SingupStep1Fragment;
Import com.chencheng.meituan.fragment.SingupStep2Fragment;
Import com.chencheng.meituan.fragment.SingupStep3Fragment;
Import android.app.Activity;
Import Android.os.Bundle;
Import android.support.v4.app.Fragment;
Import android.support.v4.app.FragmentActivity;
Import Android.support.v4.app.FragmentManager;
Import android.support.v4.app.FragmentTransaction;
Import Android.view.Menu;
Import Android.view.MenuItem;
Import Android.view.View;
Import Android.view.View.OnClickListener;
public class Userregistactivity extends Fragmentactivity implements Onclicklistener {
Private Fragment myfragment;
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.fragment_signup);
Addfragment ();
Findviewbyid (R.ID.STEP1). Setonclicklistener (this);
Findviewbyid (R.ID.STEP2). Setonclicklistener (this);
Findviewbyid (R.ID.STEP3). Setonclicklistener (this);
Setfragment (myfragment);
}
private void Setfragment (Fragment myFragment2) {
Replace
Fragmentmanager fm = Getsupportfragmentmanager ();
Fragmenttransaction ft = fm.begintransaction ();
Ft.replace (R.id.container, myfragment);
Ft.commit ();
}
private void Addfragment () {
Add to
Fragmentmanager fm = Getsupportfragmentmanager ();
Fragmenttransaction ft = fm.begintransaction ();
Myfragment = new Singupstep1fragment ();
Ft.replace (R.id.container, myfragment);
Ft.commit ();
}
@Override
public boolean Oncreateoptionsmenu (Menu menu) {
Inflate the menu; This adds items to the action bar if it is present.
Getmenuinflater (). Inflate (r.menu.user_regist, menu);
return true;
}
@Override
public boolean onoptionsitemselected (MenuItem item) {
Handle Action Bar Item clicks here. The Action Bar would
Automatically handle clicks on the Home/up button, so long
As you specify a the parent activity in Androidmanifest.xml.
int id = item.getitemid ();
if (id = = r.id.action_settings) {
return true;
}
return super.onoptionsitemselected (item);
}
@Override
public void OnClick (View v) {
TODO auto-generated Method Stub
Switch (V.getid ()) {
Case R.ID.STEP1:
Myfragment = new Singupstep1fragment ();
Setfragment (myfragment);
Break
Case R.ID.STEP2:
Myfragment = new Singupstep2fragment ();
Setfragment (myfragment);
Break
Case R.ID.STEP3:
Myfragment = new Singupstep3fragment ();
Setfragment (myfragment);
Break
Default
Break
}
}
}
CC US team-Project Registration interface implementation