Example #1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View view = convertView;
            MessagesViewHolder holder;

            if (view == null)
            {
                var inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
                view     = inflater.Inflate(row, null);
                holder   = new MessagesViewHolder();
                view.Tag = holder;
            }
            else
            {
                holder = (MessagesViewHolder)view.Tag;
            }
            try
            {
                if ((dataSource == null) || ((position + 1) > dataSource.Count))
                {
                    return(view);
                }

                currentItem = dataSource[position];
                if (currentItem != null)
                {
                    holder.Tv_Message      = view.FindViewById <TextView>(Resource.Id.tv_message);
                    holder.Tv_Message.Text = currentItem;
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            return(view);
        }
Example #2
0
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     RecyclerView.ViewHolder vh = new MessagesViewHolder(LayoutInflater.From(parent.Context).Inflate(Resource.Layout.customview_messageBox, parent, false));
     return(vh);
 }