GitXplorerGitXplorer
h

recyclerview-expandable

public
71 stars
13 forks
2 issues

Commits

List of commits on branch master.
Unverified
a77223704e8390d2776cd31179765f0f0ac6ba25

Merge commit '37b5bfe9214b9d90121e67e43719fb1fc0bb28ee'

hhanggrian committed 6 years ago
Unverified
44de3527ab6dfe16ba2984083f0367396c710c2f

Gradle 5.1

hhanggrian committed 6 years ago
Unverified
37b5bfe9214b9d90121e67e43719fb1fc0bb28ee

Update Gradle wrapper jar

hhanggrian committed 6 years ago
Unverified
bae378ae425311610ed11c667d0095155269e583

Gradle 5.1-rc-3

hhanggrian committed 6 years ago
Unverified
868b53d6d77f7465ffaad9f9f8789a8ea5cbe5af

Update README.md

hhanggrian committed 8 years ago
Unverified
5e4558f1e837f887eaa35488f89808dd78726754

cleaner example

hhanggrian committed 8 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);