Пример #1
0
        OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            // Inflate the CardView
            View itemView = LayoutInflater.From(parent.Context).
                            Inflate(Resource.Layout.RecyclerItemView, parent, false);

            // Create a ViewHolder to find and hold these view references
            DeviceViewHolder dvh = new DeviceViewHolder(itemView);

            return(dvh);
        }
Пример #2
0
        OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            DeviceViewHolder vh = holder as DeviceViewHolder;

            // Set the TextViews in this ViewHolder's CardView from this position in the data list
            vh.DeviceId.Text          = $"ID: {DevicesList[position].DeviceId}";
            vh.DeviceName.Text        = $"Name: {DevicesList[position].Name}";
            vh.DeviceTemperature.Text = $"Temperature: {DevicesList[position].Temperature} C";
            vh.DeviceHumidity.Text    = $"Humidity: {DevicesList[position].Humidity} %";
            vh.DeviceBattery.Text     = $"Battery: {DevicesList[position].Battery} %";
            vh.DeviceLastUpdated.Text = $"Last update: {DevicesList[position].LastUpdated}";
        }