protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // http://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme //Remove title bar this.RequestWindowFeature(WindowFeatures.NoTitle); //Remove notification bar this.Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); //set content view AFTER ABOVE sequence (to avoid crash) SetContentView(Resource.Layout.Main); // Get our RecyclerView layout: mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); //............................................................ // Layout Manager Setup: // Use the built-in linear layout manager: mLayoutManager = new LinearLayoutManager(this); // Or use the built-in grid layout manager (two horizontal rows): // mLayoutManager = new GridLayoutManager // (this, 2, GridLayoutManager.Horizontal, false); // Plug the layout manager into the RecyclerView: mRecyclerView.SetLayoutManager(mLayoutManager); //............................................................ // Adapter Setup: // Instantiate the MyImage album: mMyImageAlbum = new MyImageAlbum(); // Create an adapter for the RecyclerView, and pass it the // data set (the MyImage album) to manage: mAdapter = new MyImageAlbumAdapter(mMyImageAlbum); // Register the item click handler (below) with the adapter: //mAdapter.ItemClick += OnItemClick; // Plug the adapter into the RecyclerView: mRecyclerView.SetAdapter(mAdapter); mScrollListener = new MyImageAlbumOnScrollListener(mLayoutManager as LinearLayoutManager); mRecyclerView.AddOnScrollListener(mScrollListener); // needed for recording numItemsPerScreenView during first scroll mRecyclerView.SmoothScrollToPosition(mMyImageAlbum.NumImages / 2); }
// Load the adapter with the data set (photo album) at construction time: public MyImageAlbumAdapter(MyImageAlbum anImageAlbum) { mMyImageAlbum = anImageAlbum; }