通常每个Activity对应1个Layout,在onCreate时指定layout(否则引用的还是main的layout),然后调用startActivity:
protected override void OnCreate (Bundle bundle) { SetContentView (Resource.Layout.UserRegister); base.OnCreate (bundle); // Create your application here var btnBack = FindViewById<Button> (Resource.Id.btnUserRgst_Back); btnBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(MainActivity)); }; }
如果要传值,可以使用intent:
var intent = new Intent(this, typeof(UserRegister)); StartActivity(intent);
时间: 2024-10-11 13:27:26