// Fill in the contents of the photo card (invoked by the layout manager): public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { OnlineUsersViewHolder vh = holder as OnlineUsersViewHolder; // Set the ImageView and TextView in this ViewHolder's CardView // from this position in the photo album: vh.Username.Text = this.users[position].Username; vh.Admin.Visibility = (this.users[position].Admin) ? ViewStates.Visible : ViewStates.Invisible; }
// Create a new photo CardView (invoked by the layout manager): public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { // Inflate the CardView for the photo: View itemView = LayoutInflater.From(parent.Context). Inflate(Resource.Layout.OnlineUsersListView, parent, false); // Create a ViewHolder to find and hold these view references, and // register OnClick with the view holder: OnlineUsersViewHolder vh = new OnlineUsersViewHolder(itemView, OnClick); return(vh); }