コード例 #1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.PhotoCardView, parent, false);
            DropBoxViewHolder dropBoxViewHolder = new DropBoxViewHolder(itemView);

            return(dropBoxViewHolder);
        }
コード例 #2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            try
            {
                if (dropBoxRows == null && dropBoxRows.Count == 0)
                {
                    return;
                }

                DropBoxViewHolder viewHolderData = holder as DropBoxViewHolder;

                if (dropBoxRows[position].Title != null)
                {
                    viewHolderData.Title.Text = $"Title: {dropBoxRows[position]?.Title}";
                }
                else
                {
                    viewHolderData.Title.Text = "Title: No Title Available here!";
                }
                if (dropBoxRows[position].Description != null)
                {
                    viewHolderData.Description.Text = $"Description: {dropBoxRows[position]?.Description}";
                }
                else
                {
                    viewHolderData.Description.Text = "Description: No Description Available here!";
                }
                if (dropBoxRows[position].ImageHref != null)
                {
                    Picasso.With(recyclerViewActivityContext).Load(dropBoxRows[position]?.ImageHref).Error(Resource.Mipmap.Icon).Into(viewHolderData.Imageview);
                }
            }
            catch (Exception)
            {
            }
        }