Esempio n. 1
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            PostViewHolder vh = viewHolder as PostViewHolder;

            // Load the photo image resource from the photo album:
            vh.Image.SetImageBitmap(itemPics[position]);

            // Load the photo caption from the photo album:
            vh.Post.Text = items[position].text;
        }
Esempio n. 2
0
        // Create new views (invoked by the layout manager)
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            // set the view's size, margins, paddings and layout parameters
            // Inflate the CardView for the photo:
            View itemView = LayoutInflater.From(parent.Context).
                            Inflate(Resource.Layout.PostCardView, parent, false);

            // Create a ViewHolder to hold view references inside the CardView:
            PostViewHolder vh = new PostViewHolder(itemView, OnClick);

            return(vh);
        }