我找不到一个用单声道做这件事的例子。
有什么帮助吗?
编辑:添加代码
foreach (equip item in list)
{
tr = new TableRow(this);
sp = new Spinner(this);
sp.LayoutParameters = lp2;
sp.Adapter = adapter;
sp.ItemSelected += new EventHandler<ItemEventArgs>(spinner_ItemSelected());
sp.SetSelection(Convert.ToInt32(item.status));
tr.AddView(sp);
}
private void spinner_ItemSelected(object sender, ItemEventArgs e)
{
Spinner spinner = (Spinner)sender;
string toast = string.Format ("You selected {0}", spinner.GetItemAtPosition (e.Position));
Toast.MakeText (this, toast, ToastLength.Long).Show ();
}发布于 2012-01-12 05:43:11
在Mono for Android中,很多监听器接口已经被转换为C#事件,包括这个。在这种情况下,您可以连接到ItemSelected事件,而不必创建侦听器。Xamarin有一个使用微调器的完整示例,可用here。
编辑:
根据您对微调器值实际更改时间的区分请求,您可以执行如下操作:
int initialSpinnerPosition = spinner.SelectedItemPosition;
spinner.ItemSelected += (sender, args) =>
{
if (args.Position != initialSpinnerPosition)
{
// do stuff
}
};发布于 2013-12-20 05:09:45
您可以像这样使用标记
bool userClick = false;
spinner.ItemSelected += (sender, e) => {
if(userClick) {
--- do stuff
}
userClick = true;
};当您基于SQL数据创建/更新微调适配器时
userClick = false;https://stackoverflow.com/questions/8826875
复制相似问题