コード例 #1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            Button button = new Button(parent.Context);

            #region Designing the button
            var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ValueConverter.DpToPx(33));
            layoutParams.TopMargin  = ValueConverter.DpToPx(10);
            layoutParams.LeftMargin = ValueConverter.DpToPx(10);


            button.LayoutParameters = layoutParams;
            button.SetAllCaps(false);
            button.Typeface = Typeface.Create("sans-serif", TypefaceStyle.Normal);
            button.SetPadding(ValueConverter.DpToPx(20), 0, ValueConverter.DpToPx(20), 0);
            button.SetBackgroundResource(Resource.Drawable.bg_roundedGray);
            #endregion

            RecyclerView.ViewHolder vh = new GradeViewHolder(button);
            return(vh);
        }
コード例 #2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            GradeViewHolder vh = holder as GradeViewHolder;

            vh.GradeButton.Text = contentCollection[position].ToString();
        }