// Устанавливаем значения из Weather public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { WeatherViewHolder vh = holder as WeatherViewHolder; vh.Data.Text = DateTimeToStringTimeZone(position); vh.WeatherDescription.Text = weather.List[position].Weather[0].Description; vh.LowTemperature.Text = string.Format("{0:0}", weather.List[position].Main.TempMin) + "\u00b0"; string WeatherDescriptionGeneral = weather.List[position].Weather[0].Main.ToString(); //Устанавливаем icon в зависимости от значения в Weather switch (WeatherDescriptionGeneral) { case "Clear": vh.WeatherIcon.SetImageResource(Resource.Drawable.ic_clear); break; case "Clouds": vh.WeatherIcon.SetImageResource(Resource.Drawable.ic_cloudy); break; case "Rain": vh.WeatherIcon.SetImageResource(Resource.Drawable.ic_light_rain); break; default: vh.WeatherIcon.SetImageResource(Resource.Drawable.ic_snow); break; } }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context). Inflate(Resource.Layout.forcast_list_item, parent, false); WeatherViewHolder vh = new WeatherViewHolder(itemView, OnClick); return(vh); }