예제 #1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.MessageEntry, parent, false);

            ChatViewHolder vh = new ChatViewHolder(itemView, OnClick);

            return(vh);
        }
예제 #2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            ChatViewHolder vh    = holder as ChatViewHolder;
            MessageEntry   entry = Entries[position];

            if (selectedPos == position)
            {
                holder.ItemView.SetBackgroundColor(Android.Graphics.Color.LightGray);
            }
            else
            {
                holder.ItemView.SetBackgroundColor(Android.Graphics.Color.Transparent);
            }

            vh.Message.Text = entry.Message;
            vh.Name.Text    = entry.Name;

            holder.ItemView.Selected = selectedPos == position;
        }