RecyclerView Archives - wiki

Android using multiple layout in RecyclerView

In this tutorial I am explaining how to implement multiple layout in a single RecyclerView

Add ‘com.android.support:recyclerview‘ in Gradle dependencies and sync it (Check this tutorial for Recycler View example http://wiki.workassis.com/android-recyclerview-example/)

MainActivity

MyMediatorInterface

MyAdapter

GroupTitleModel

UserModel

ItemInterface

Layouts
activity_main.xml

row_item_group_title.xml

row_user_item.xml

Output

recyclerview-multiple-layout

 

1 Like
By bm on August 31, 2016 | Android | A comment?
Tags: , , ,

Android RecyclerView Example

Android RecyclerView example using view hodelr in adapter

(For using multiple layout in RecyclerView check this tutorial )

Add ‘com.android.support:recyclerview‘ in Gradle dependencies and sync it

my app/build.gradle file

MainActivity

Model

Adapter

Interface:

Layouts

Recycler View row

Out Put

recyclerview

 

If you want to add data to RecyclerView  add data into the Array List (eg:- usersList.add(new UserModel(“new name”, “345”)); and you can call the adapter function notifyItemInserted() or notifyDatasetChanged().

While editing edit the value in array list and call notifyItemChanged(position), while deleting delete the position from array list and call notifyItemRemoved(position)

 

  Like
By bm on August 30, 2016 | Android | A comment?
Tags: , ,