5

What's the best and easiest way to decorate RecyclerView to have such look & feel? i am developing an travels seat booking application... i know i can do it with recyclerview with gridlayout manager..but what should be the steps i dont know one thing to be note each bus have different seating arrangemen

enter image description here

enter image description here

enter image description here

Tufan
  • 2,789
  • 4
  • 34
  • 52

3 Answers3

8

I suggest you to use StaggeredGridLayoutmanager for your recycler view.

StaggeredGridLayout for RecyclerView

It's the closest approach to achieve your layout.

You can find the docs here. And working example can be found here.

Aawaz Gyawali
  • 3,244
  • 5
  • 28
  • 48
3

You can learn from this example which explain perfect about Recycler View

enter image description here

Hope this works for you

Anshul Khare
  • 391
  • 1
  • 4
  • 13
1

Based on the type of bus choice, switch between GridLayoutManager, and StaggeredGridLayoutManager.

For all the types, use a header view with just a steering wheel icon right aligned.

  1. For the seater-only type:
    • use a 4 span GridLayoutManager
    • use an item decorator for providing the spacing between the 2nd and 3rd column
    • use a footer view with 5 seats view
  2. For the mixed-type:
    • use a 3 span StaggeredGridLayoutManager
    • use an item decorator for providing the spacing between the 1st and 2nd column.
    • use different item type for the sleeper seats (see: onCreateViewHolder(parent,viewType))
  3. For the sleeper-only type.
    • use a 4 span GridLayoutManager
    • use an item decorator for providing the spacing between the 1st and 2nd column
Avinash R
  • 3,101
  • 1
  • 27
  • 47
  • Do you have some sample or anything else..i am not able to find anything like it... – Tufan Aug 05 '15 at 06:25
  • @tufan, first lesson on SO: don't ask for code. – Avinash R Aug 05 '15 at 06:28
  • okay ...but can you tell me in your 3rd step use an item decorator for providing the spacing between the 1st and 2nd column..how to do it – Tufan Aug 05 '15 at 06:29
  • The answer here is enough to help you out with your layout. If you don't understand what the answer is taking about, then you'd better learn more about RecyclerView. There are a lot of tutorials out there. – Avinash R Aug 05 '15 at 06:31
  • @Tufan Google for "item decorator in RecyclerView" – Avinash R Aug 05 '15 at 06:32
  • okay thank you i am searching for it....i had lost my hope now i have a seen a light ...i m trying thanks – Tufan Aug 05 '15 at 06:33