示例#1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            // Inflate the CardView for the photo:
            View itemView = LayoutInflater.From(parent.Context).
                            Inflate(Resource.Layout.ContactCard, parent, false);

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

            return(vh);
        }
示例#2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            ContactViewHolder vh = holder as ContactViewHolder;

            //remove hard coding and add dynamic path
            //vh.personPhoto.SetImageURI(Android.Net.Uri.Parse("android.resource://SIMarketplace.Android/drawable/" + Contacts[position].ImageURL));
            if (Contacts[position].Name.Contains("Brian"))
            {
                vh.personPhoto.SetImageResource(Resource.Drawable.BrianBreit);
            }
            else if (Contacts[position].Name.Contains("Azunna"))
            {
                vh.personPhoto.SetImageResource(Resource.Drawable.AzunnaAnyanwu);
            }
            else if (Contacts[position].Name.Contains("Jason"))
            {
                vh.personPhoto.SetImageResource(Resource.Drawable.JasonBowers);
            }

            vh.personName.Text        = Contacts[position].Name;
            vh.personEmail.Text       = Contacts[position].Email;
            vh.personDescription.Text = Contacts[position].Description;
        }