我想在ItemClick
中获取ListView
但无法检测到。我尝试在ClickListener
的{{1}}方法中实施GetView()
,并尝试BaseAdapter
ItemClick
。我没有取得任何成功。这是我的片段。
在此摘要片段中,我尝试在ListView
ClickListener
GetView()
我也试过了ItemClick,这里也是一个片段。
public override View GetView(int position, View convertView, ViewGroup parent)
{
View view = context.LayoutInflater.Inflate(Resource.Layout.single_row_listview_item, parent, false);
ImageView photo = view.FindViewById<ImageView>(Resource.Id.photoImageView);
TextView name = view.FindViewById<TextView>(Resource.Id.nameTextView);
TextView speciality = view.FindViewById<TextView>(Resource.Id.specialtyTextView);
Stream stream = context.Assets.Open(places[position].ImageUrl);
Drawable drawable = Drawable.CreateFromStream(stream, null);
photo.SetImageDrawable(drawable);
name.Text = places[position].Name;
speciality.Text = places[position].Specialty;
name.Click += delegate
{
CommonUtils.showToast(context, "Click on name");
};
speciality.Click += delegate
{
CommonUtils.showToast(context, "Click on speciality");
};
photo.Click += delegate
{
CommonUtils.showToast(context, "Click on photo");
};
view.Click += delegate
{
CommonUtils.showToast(context, "Click on view");
};
return view;
}
非常感谢任何帮助。