Example #1
0
        public override View GetView(int position, global::Android.Views.View convertView, ViewGroup parent)
        {
            var        item       = items[position];
            ViewHolder viewHolder = ViewHolder.Get(context, convertView, parent, layoutId, position);

            if (OnGetView != null)
            {
                return(OnGetView(position, convertView, parent, item, viewHolder));
            }
            return(convertView);
        }
 //单例模式获取对象实例
 public static ViewHolder Get(Activity context, View convertView, ViewGroup parent, int layoutID, int position)
 {
     if (convertView == null)
     {
         return(new ViewHolder(context, parent, layoutID, position));
     }
     else
     {
         ViewHolder holder = (ViewHolder)convertView.Tag;
         holder.position = position;
         return(holder);
     }
 }