public override View GetView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if(convertView == null) { convertView = LayoutInflater.From(context).Inflate(Resource.Layout.list_item, parent, false); viewHolder = new ViewHolder(); viewHolder.TextView = convertView.FindViewById<TextView>(Android.Resource.Id.Text1); convertView.Tag = viewHolder; } else { viewHolder = (ViewHolder)convertView.Tag; } var values = data[position].Split(','); var name = values[0]; var flagresId = context.Resources.GetIdentifier(values[1], "drawable", context.PackageName); viewHolder.TextView.Text = name; viewHolder.TextView.SetCompoundDrawablesWithIntrinsicBounds(flagresId, 0, 0, 0); return convertView; }
public override View GetView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = LayoutInflater.From(context).Inflate(Resource.Layout.list_item, parent, false); viewHolder = new ViewHolder(); viewHolder.TextView = convertView.FindViewById <TextView>(Android.Resource.Id.Text1); convertView.Tag = viewHolder; } else { viewHolder = (ViewHolder)convertView.Tag; } var values = data[position].Split(','); var name = values[0]; var flagresId = context.Resources.GetIdentifier(values[1], "drawable", context.PackageName); viewHolder.TextView.Text = name; viewHolder.TextView.SetCompoundDrawablesWithIntrinsicBounds(flagresId, 0, 0, 0); return(convertView); }