GitXplorerGitXplorer
h

recyclerview-expandable

public
71 stars
13 forks
2 issues

Commits

List of commits on branch master.
Verified
46bbe78ec6cfe42357d92f25f16b37c164229cdb

Fix badges

hhanggrian committed 5 years ago
Verified
c0ccd13bfa363d0da390f58832bed354d6b7d914

Update README.md

hhanggrian committed 5 years ago
Unverified
392bc4cf6a857553bbc9c4579198e7f64374fd07

updated README

hhanggrian committed 6 years ago
Unverified
5f8675c0c8acfb4f54d1776c9f999df7d0ab4ff8

Add badges

hhanggrian committed 6 years ago
Unverified
cbd22dfea7c948c0f6cd88bf0211f5b606ecd175

Remove ignored files

hhanggrian committed 6 years ago
Unverified
b740659e298ade7abaa3ae9c5e4a442a887a920d

AndroidX migration

hhanggrian committed 6 years ago

README

The README file for this repository.

download build license

Expandable RecyclerView

RecyclerView implementation of traex's ExpandableLayout.

Download

repositories {
    google()
    jcenter()
}

dependencies {
    compile "com.hendraanggrian.recyclerview:recyclerview-expandable:$version"
}

Usage

demo

Create a row of your RecyclerView:

<com.hendraanggrian.recyclerview.widget.ExpandableItem
    android:id="@+id/row"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:duration="500"
    app:layoutHeader="@layout/view_content"
    app:layoutContent="@layout/view_header"/>

Create your adapter, which must extend ExpandableRecyclerView.Adapter:

public class MyAdapter extends ExpandableRecyclerView.Adapter<MyAdapter.ViewHolder> {

    public MyAdapter(LinearLayoutManager layout) {
        super(layout);
        ...
    }

    @Override
    public void onBindViewHolder(MyAdapter.ViewHolder holder, final int position) {
        super.onBindViewHolder(holder, position);
        ...
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        ...
    }
}

Have an ExpandableRecyclerView somewhere in your app, regular RecyclerView works too.

<com.hendraanggrian.recyclerview.widget.ExpandableRecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Then pass LinearLayoutManager to the adapter:

LinearLayoutManager layout = new LinearLayoutManager(this);
RecyclerView.Adapter adapter = new MyAdapter(layout);

recyclerView.setLayoutManager(layout);
recyclerView.setAdapter(adapter);