Spinner state;
TextView tvSp;
ArrayAdapter<String> aas;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
state = FindViewById<Spinner>(Resource.Id.Sp);
tvSp = FindViewById<TextView>(Resource.Id.tvSp);
aas = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem);
state.Adapter = aas;
aas.Add(String.Empty);
aas.Add("Alabam");
aas.Add("China");
aas.Add("American");
aas.Add("California");
state.ItemSelected += new EventHandler<ItemEventArgs>(sp_ItemSelected);
}
void sp_ItemSelected(object sender, ItemEventArgs e)
{
tvSp.Text = Convert.ToString(aas.GetItem(e.Position));
}
然后报错:错误 2 无法将类型“System.EventHandler”隐式转换为“System.EventHandler”