private void InitView() { gv_server = View.FindViewById <GridView> (Resource.Id.gv_server); var adapter = new ServerItemAdapter(Activity); adapter.Add(new ServerTypeItem() { ServerTypeName = "管理员", ServerTypeImage = Resource.Drawable.icon_admin, FuncType = FuncActivityType.AdminMain }); adapter.Add(new ServerTypeItem() { ServerTypeName = "跑腿", ServerTypeImage = Resource.Drawable.icon_run, FuncType = FuncActivityType.ErrandMain }); adapter.Add(new ServerTypeItem() { ServerTypeName = "护理", ServerTypeImage = Resource.Drawable.icon_nurse, FuncType = FuncActivityType.NurseMain }); adapter.Add(new ServerTypeItem() { ServerTypeName = "家政", ServerTypeImage = Resource.Drawable.icon_housekeep, FuncType = FuncActivityType.HouseKeepMain }); gv_server.Adapter = adapter; //gridview 单击事件 gv_server.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { var clickItem = adapter.GetItem(e.Position); EldYoungUtil.StartTargetActivity(Activity, clickItem.FuncType); }; }
private void InitView() { gv_server = View.FindViewById<GridView> (Resource.Id.gv_server); var adapter = new ServerItemAdapter (Activity); adapter.Add(new ServerTypeItem(){ServerTypeName="管理员",ServerTypeImage= Resource.Drawable.icon_admin,FuncType = FuncActivityType.AdminMain}); adapter.Add (new ServerTypeItem (){ ServerTypeName = "跑腿", ServerTypeImage = Resource.Drawable.icon_run,FuncType =FuncActivityType.ErrandMain }); adapter.Add(new ServerTypeItem(){ServerTypeName="护理",ServerTypeImage= Resource.Drawable.icon_nurse,FuncType = FuncActivityType.NurseMain}); adapter.Add (new ServerTypeItem (){ ServerTypeName = "家政", ServerTypeImage = Resource.Drawable.icon_housekeep,FuncType = FuncActivityType.HouseKeepMain }); gv_server.Adapter = adapter; //gridview 单击事件 gv_server.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { var clickItem = adapter.GetItem(e.Position); EldYoungUtil.StartTargetActivity(Activity,clickItem.FuncType); }; }