creating layout in recyclerview list respective to the arraylist in json response

36 Views Asked by At

I am developing a food order application.I am having a page to display menus in a particular hotel in a recyclerview.Please see the image below to understand my question.Hotels have menus like bestsellers,soups,maincourse,starters etc...Some hotels have 5 menus ,some hotels have 8 menus etc.Menus will vary depends on hotels.so how can i design my layout for that.I need to have the menu title at the top of each layout and submenu items below that.Is it needs to done on layout side or api response side.picture1picture2

1

There are 1 best solutions below

0
Jean Pimentel On

RecyclerView supports multiple ViewTypes, so you can create multiple ViewHolders, each on with a different layout.

https://medium.com/@paulnunezm/working-with-recyclerview-and-multiple-view-types-bb1e7dfc6993