コード例 #1
0
 public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
 {
     if (holder is PhotoViewHolder)
     {
         PhotoViewHolder photoViewHolder = holder as PhotoViewHolder;
         photoViewHolder.Image.SetImageResource(mPhotoAlbum[position].PhotoID);
         photoViewHolder.Caption.Text = mPhotoAlbum[position].Caption;
     }
 }
コード例 #2
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            if (viewType == TYPE_ITEM)
            {
                context = parent.Context;
                View            itemView        = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.PhotoCardView, parent, false);
                PhotoViewHolder photoViewHolder = new PhotoViewHolder(itemView, OnClick);
                return(photoViewHolder);
            }
            else if (viewType == TYPE_FOOTER)
            {
                View view = LayoutInflater.From(parent.Context)
                            .Inflate(Resource.Layout.layout_refresh_footer, parent, false);
                return(new FootViewHolder(view));
            }

            return(null);
        }