コード例 #1
0
ファイル: MainActivity.cs プロジェクト: niklasjk/ShoppingList
        OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            // Inflate the CardView for the photo:
            View itemView = LayoutInflater.From(parent.Context).
                            Inflate(Resource.Layout.ListItem, parent, false);

            View row = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ListItem, parent, false);

            // Create a ViewHolder to find and hold these view references, and
            // register OnClick with the view holder:
            ListitemViewHolder vh = new ListitemViewHolder(itemView, OnClick, OnLongClick, OnChkBoxClick, OnImageClick);

            return(vh);
        }
コード例 #2
0
ファイル: MainActivity.cs プロジェクト: niklasjk/ShoppingList
        OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            ListitemViewHolder vh = holder as ListitemViewHolder;

            int checkeRresourceId = (int)typeof(Resource.Drawable).GetField("ic_check_box_white_24dp").GetValue(null);
            int resourceId        = (int)typeof(Resource.Drawable).GetField("ic_check_box_outline_blank_white_24dp").GetValue(null);


            // Set the ImageView and TextView in this ViewHolder's CardView
            // from this position in the photo album:
            vh.Image.SetImageBitmap(mShoppingList[position].bm);
            vh.Description.Text = mShoppingList[position].title;
            if (mShoppingList[vh.AdapterPosition].check == 1)
            {
                vh.ChkBox.SetImageResource(checkeRresourceId);
            }
            else
            {
                vh.ChkBox.SetImageResource(resourceId);
            }
            vh.Image.Tag = mShoppingList[position].path;
        }