public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_list_view_item_animations, container, false); this.listView = (RadListView)rootView.FindViewById(Resource.Id.listView).JavaCast <RadListView>(); ArrayList source = new ArrayList(); source.Add("Item 1"); source.Add("Item 2"); source.Add("Item 3"); source.Add("Item 4"); source.Add("Item 5"); this.listView.SetAdapter(new AnimationsListViewAdapter(source)); Button setFade = (Button)rootView.FindViewById(Resource.Id.btnSetFade); setFade.Click += (object sender, EventArgs e) => { listView.SetItemAnimator(new FadeItemAnimator()); }; Button setSlide = (Button)rootView.FindViewById(Resource.Id.btnSetSlide); setSlide.Click += (object sender, EventArgs e) => { listView.SetItemAnimator(new SlideItemAnimator()); }; Button setScale = (Button)rootView.FindViewById(Resource.Id.btnSetScale); setScale.Click += (object sender, EventArgs e) => { listView.SetItemAnimator(new ScaleItemAnimator()); }; this.btnAddItem = (Button)rootView.FindViewById(Resource.Id.btnAddItem); this.btnAddItem.Click += (object sender, EventArgs e) => { AnimationsListViewAdapter adapter = (AnimationsListViewAdapter)listView.GetAdapter(); adapter.Add(0, "Item " + adapter.ItemCount); }; this.btnRemoveItem = (Button)rootView.FindViewById(Resource.Id.btnRemoveItem); this.btnRemoveItem.Click += (object sender, EventArgs e) => { AnimationsListViewAdapter adapter = (AnimationsListViewAdapter)listView.GetAdapter(); if (adapter.ItemCount > 0) { adapter.Remove(0); } }; return(rootView); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_list_view_item_animations, container, false); this.listView = (RadListView) rootView.FindViewById(Resource.Id.listView).JavaCast<RadListView>(); ArrayList source = new ArrayList(); source.Add("Item 1"); source.Add("Item 2"); source.Add("Item 3"); source.Add("Item 4"); source.Add("Item 5"); this.listView.SetAdapter(new AnimationsListViewAdapter(source)); Button setFade = (Button)rootView.FindViewById(Resource.Id.btnSetFade); setFade.Click += (object sender, EventArgs e) => { listView.SetItemAnimator(new FadeItemAnimator()); }; Button setSlide = (Button)rootView.FindViewById(Resource.Id.btnSetSlide); setSlide.Click += (object sender, EventArgs e) => { listView.SetItemAnimator(new SlideItemAnimator()); }; Button setScale = (Button)rootView.FindViewById(Resource.Id.btnSetScale); setScale.Click += (object sender, EventArgs e) => { listView.SetItemAnimator(new ScaleItemAnimator()); }; this.btnAddItem = (Button)rootView.FindViewById(Resource.Id.btnAddItem); this.btnAddItem.Click += (object sender, EventArgs e) => { AnimationsListViewAdapter adapter = (AnimationsListViewAdapter)listView.GetAdapter(); adapter.Add(0, "Item " + adapter.ItemCount); }; this.btnRemoveItem = (Button)rootView.FindViewById(Resource.Id.btnRemoveItem); this.btnRemoveItem.Click += (object sender, EventArgs e) => { AnimationsListViewAdapter adapter = (AnimationsListViewAdapter)listView.GetAdapter(); if (adapter.ItemCount > 0) { adapter.Remove(0); } }; return rootView; }