Skip to content

CORDEA/GroupieXamarin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nuget

GroupieXamarin

Xamarin bindings library for the groupie library.

Groupie is a simple, flexible library for complex RecyclerView layouts.

Currently this library supports only groupie 2.1.0 because groupie 2.2.0 or later has been migrated to AndroidX but task to migrate Xamarin.Android bindings to AndroidX seems to be in progress. So, I can not binding latest library yet because package name does not match. (If you know how to bind, please let me know.)

Usage

class ListItem : Item
{
    private readonly string _title;

    public ListItem(string title)
    {
        _title = title;
    }

    public override void Bind(Object holder, int position)
    {
        var viewHolder = (ViewHolder) holder;
        var title = viewHolder.Root.FindViewById<TextView>(Resource.Id.title);
        title.Text = _title;
    }

    public override int Layout => Resource.Layout.list_item;
}
var adapter = new GroupAdapter();
adapter.Add(new ListItem("1"));

var recyclerView = FindViewById<RecyclerView>(Resource.Id.recycler_view);
recyclerView.SetLayoutManager(new LinearLayoutManager(this));
recyclerView.SetAdapter(adapter);

If you want more examples, you can refer Sample and groupie's example.