C# uses Xamarin to develop applications -- switching activities

黄舟
Release: 2017-03-01 10:38:43
Original
2086 people have browsed it

Usually each Activity corresponds to 1 Layout. Specify the layout during onCreate (otherwise it still refers to the main layout), and then call 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));
			};
		}
Copy after login

If you want to pass Value, you can use intent:

var intent = new Intent(this, typeof(UserRegister));
				StartActivity(intent);
Copy after login

The above is the content of C# using Xamarin to develop applications--switching Activity. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!