protected override RecyclerView.ViewHolder CreateSectionHeaderViewHolder(ViewGroup parent) { var sectionHeaderTextView = RecyclerViewAdapter.CreateTextView(parent); sectionHeaderTextView.SetBackgroundColor(Color.LightBlue); sectionHeaderTextView.TextAlignment = TextAlignment.Center; return(new ViewHolder(sectionHeaderTextView)); }
protected override RecyclerView.ViewHolder CreateItemViewHolder(ViewGroup parent) { var itemTextView = RecyclerViewAdapter.CreateTextView(parent); var viewHolder = new ViewHolder(itemTextView); itemTextView.Click += (sender, e) => { this.AddNewRow(viewHolder.Section); }; return(viewHolder); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); var recyclerView = this.FindViewById <RecyclerView>(Resource.Id.RecyclerView); var adapter = new RecyclerViewAdapter(); var layoutManager = new LinearLayoutManager(this); recyclerView.SetAdapter(adapter); recyclerView.SetLayoutManager(layoutManager); }