In this post i am going to explain how to inflate multiple view in RecyclerView in your android application. If you want to learn about RecyclerView please follow this link. This post help to make your app look much better and also explain you how to pass multiple view in your list.

RecyclerView with MultipleView

Step 1: Create a new project in your android studio and add dependencies in your project build.grade file


Step 2: Now create new layout file inside res ⇒ layout for custom toolbar toolbar.xml .


Step 3: Now open your acitvity_main.xml file inside layout folder and include your toolbar and add RecyclerView as shown below


Step 4: Now create Multiple layout file which we are going to pass in our recycler view i create three different layout file which we are going to inflate in our RecyclerView . Here is file name with there code which i create. Place these file inside res  ⇒ layout folder. Below file contain simple code most of us familiar with that.


File 1: category_template_one.xml


File 2. category_template_two.xml


File 3. category_template_three.xml


Step 5: Now we can create custom adapter which is backbone for this sample if you want to learn about custom adapter in RecyclerView please follow this post, also create class which in we going to create getter setter use in our app by our adapter. Open your custom Adapter class and add Override method getItemViewType . In this override method we set layout according to there position .


Step 6: In Custom Adapter add following code to oncreateViewHolder method . In this we return view according to its view type.


Complete code for your


Complete code for

Please follow above download link to download complete code for your project. Hope this sample code help you to learn about RecyclerView with mutiple view.