protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); Thread t = new Thread(ThreadTest); t.Start(); }private void ThreadTest() { int i = 0; TextView timerView = FindViewById(Resource.Id.timerView); while (true) { this.RunOnUiThread(delegate { timerView.Text = (i++).ToString(); }); //需要操作UI时,只需RunOnUiThread即可 Thread.Sleep(1000); } }
还有用handle,暂时没有试过