public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_list_view_layouts, container, false); this.listView = (RadListView)rootView.FindViewById(Resource.Id.listView).JavaCast<RadListView>(); Button btnLinear = (Button)rootView.FindViewById(Resource.Id.btnLinear); btnLinear.Click += (object sender, EventArgs e) => { listView.SetLayoutManager(new LinearLayoutManager(this.Activity)); }; Button btnStaggered = (Button)rootView.FindViewById(Resource.Id.btnStaggered); btnStaggered.Click += (object sender, EventArgs e) => { StaggeredGridLayoutManager slm = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.Vertical); listView.SetLayoutManager(slm); }; Button btnGrid = (Button)rootView.FindViewById(Resource.Id.btnGrid); btnGrid.Click += (object sender, EventArgs e) => { GridLayoutManager glm = new GridLayoutManager(this.Activity, 3, GridLayoutManager.Vertical, false); listView.SetLayoutManager(glm); }; Button btnDeck = (Button)rootView.FindViewById(Resource.Id.btnDeck); btnDeck.Click += (object sender, EventArgs e) => { DeckOfCardsLayoutManager dclm = new DeckOfCardsLayoutManager(this.Activity); listView.SetLayoutManager(dclm); }; ArrayList source = new ArrayList(); for (int i = 0; i < 50; i++) { source.Add(this.getRandomText()); } this.listView.SetAdapter(new LayoutsListViewAdapter(source)); return rootView; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_list_view_layouts, container, false); this.listView = (RadListView)rootView.FindViewById(Resource.Id.listView).JavaCast <RadListView>(); Button btnLinear = (Button)rootView.FindViewById(Resource.Id.btnLinear); btnLinear.Click += (object sender, EventArgs e) => { listView.SetLayoutManager(new LinearLayoutManager(this.Activity)); }; Button btnStaggered = (Button)rootView.FindViewById(Resource.Id.btnStaggered); btnStaggered.Click += (object sender, EventArgs e) => { StaggeredGridLayoutManager slm = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.Vertical); listView.SetLayoutManager(slm); }; Button btnGrid = (Button)rootView.FindViewById(Resource.Id.btnGrid); btnGrid.Click += (object sender, EventArgs e) => { GridLayoutManager glm = new GridLayoutManager(this.Activity, 3, GridLayoutManager.Vertical, false); listView.SetLayoutManager(glm); }; Button btnDeck = (Button)rootView.FindViewById(Resource.Id.btnDeck); btnDeck.Click += (object sender, EventArgs e) => { DeckOfCardsLayoutManager dclm = new DeckOfCardsLayoutManager(this.Activity); listView.SetLayoutManager(dclm); }; ArrayList source = new ArrayList(); for (int i = 0; i < 50; i++) { source.Add(this.getRandomText()); } this.listView.SetAdapter(new LayoutsListViewAdapter(source)); return(rootView); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_list_view_deck, container, false); listView = (RadListView)rootView.FindViewById(Resource.Id.listView).JavaCast<RadListView>(); CountryAdapter adapter = new CountryAdapter(getData()); listView.SetAdapter(adapter); deckOfCardsLayoutManager = new DeckOfCardsLayoutManager(Activity); listView.SetLayoutManager(deckOfCardsLayoutManager); Button orientationBtn = (Button)rootView.FindViewById (Resource.Id.orientationBtn); orientationBtn.Click += (object sender, EventArgs e) => { if(orientation == OrientationHelper.Vertical) { orientation = OrientationHelper.Horizontal; } else { orientation = OrientationHelper.Vertical; } deckOfCardsLayoutManager = new DeckOfCardsLayoutManager(Activity, orientation, reverseLayout); listView.SetLayoutManager(deckOfCardsLayoutManager); }; Button reverseBtn = (Button)rootView.FindViewById (Resource.Id.reverseBtn); reverseBtn.Click += (object sender, EventArgs e) => { reverseLayout = !reverseLayout; deckOfCardsLayoutManager = new DeckOfCardsLayoutManager(Activity, orientation, reverseLayout); listView.SetLayoutManager(deckOfCardsLayoutManager); }; Button countBtn = (Button)rootView.FindViewById (Resource.Id.countBtn); countBtn.Click += (object sender, EventArgs e) => { if(deckOfCardsLayoutManager.PerspectiveItemsCount == 2) { deckOfCardsLayoutManager.PerspectiveItemsCount = 5; } else { deckOfCardsLayoutManager.PerspectiveItemsCount = 2; } }; Button perspectiveBtn = (Button)rootView.FindViewById(Resource.Id.perspectiveBtn); perspectiveBtn.Click += (object sender, EventArgs e) => { if(deckOfCardsLayoutManager.Perspective().TranslateStart != PerspectiveChangeInfo.DefaultTranslation) { deckOfCardsLayoutManager.Perspective().TranslateStart = PerspectiveChangeInfo.DefaultTranslation; deckOfCardsLayoutManager.Perspective().TranslateTop = PerspectiveChangeInfo.DefaultTranslation; deckOfCardsLayoutManager.Perspective().TranslateEnd = PerspectiveChangeInfo.DefaultTranslation; } else { deckOfCardsLayoutManager.Perspective().TranslateStart = -50; deckOfCardsLayoutManager.Perspective().TranslateTop = -50; deckOfCardsLayoutManager.Perspective().TranslateEnd = -50; } }; Button previousBtn = (Button)rootView.FindViewById(Resource.Id.previousBtn); previousBtn.Click += (object sender, EventArgs e) => { deckOfCardsLayoutManager.ScrollToPrevious(); }; Button nextBtn = (Button)rootView.FindViewById(Resource.Id.nextBtn); nextBtn.Click += (object sender, EventArgs e) => { deckOfCardsLayoutManager.ScrollToNext(); }; return rootView; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.Inflate(Resource.Layout.fragment_list_view_deck, container, false); listView = (RadListView)rootView.FindViewById(Resource.Id.listView).JavaCast <RadListView>(); CountryAdapter adapter = new CountryAdapter(getData()); listView.SetAdapter(adapter); deckOfCardsLayoutManager = new DeckOfCardsLayoutManager(Activity); listView.SetLayoutManager(deckOfCardsLayoutManager); Button orientationBtn = (Button)rootView.FindViewById(Resource.Id.orientationBtn); orientationBtn.Click += (object sender, EventArgs e) => { if (orientation == OrientationHelper.Vertical) { orientation = OrientationHelper.Horizontal; } else { orientation = OrientationHelper.Vertical; } deckOfCardsLayoutManager = new DeckOfCardsLayoutManager(Activity, orientation, reverseLayout); listView.SetLayoutManager(deckOfCardsLayoutManager); }; Button reverseBtn = (Button)rootView.FindViewById(Resource.Id.reverseBtn); reverseBtn.Click += (object sender, EventArgs e) => { reverseLayout = !reverseLayout; deckOfCardsLayoutManager = new DeckOfCardsLayoutManager(Activity, orientation, reverseLayout); listView.SetLayoutManager(deckOfCardsLayoutManager); }; Button countBtn = (Button)rootView.FindViewById(Resource.Id.countBtn); countBtn.Click += (object sender, EventArgs e) => { if (deckOfCardsLayoutManager.PerspectiveItemsCount == 2) { deckOfCardsLayoutManager.PerspectiveItemsCount = 5; } else { deckOfCardsLayoutManager.PerspectiveItemsCount = 2; } }; Button perspectiveBtn = (Button)rootView.FindViewById(Resource.Id.perspectiveBtn); perspectiveBtn.Click += (object sender, EventArgs e) => { if (deckOfCardsLayoutManager.Perspective().TranslateStart != PerspectiveChangeInfo.DefaultTranslation) { deckOfCardsLayoutManager.Perspective().TranslateStart = PerspectiveChangeInfo.DefaultTranslation; deckOfCardsLayoutManager.Perspective().TranslateTop = PerspectiveChangeInfo.DefaultTranslation; deckOfCardsLayoutManager.Perspective().TranslateEnd = PerspectiveChangeInfo.DefaultTranslation; } else { deckOfCardsLayoutManager.Perspective().TranslateStart = -50; deckOfCardsLayoutManager.Perspective().TranslateTop = -50; deckOfCardsLayoutManager.Perspective().TranslateEnd = -50; } }; Button previousBtn = (Button)rootView.FindViewById(Resource.Id.previousBtn); previousBtn.Click += (object sender, EventArgs e) => { deckOfCardsLayoutManager.ScrollToPrevious(); }; Button nextBtn = (Button)rootView.FindViewById(Resource.Id.nextBtn); nextBtn.Click += (object sender, EventArgs e) => { deckOfCardsLayoutManager.ScrollToNext(); }; return(rootView); }