RecyclerView with GridLayoutManager [duplicate]
Asked Answered
C

3

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

Clyte answered 28/7, 2015 at 5:10 Comment(0)
M
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.

Misadvise answered 28/7, 2015 at 5:17 Comment(3)
how you do this layout ....can you post some sample codeClyte
@AawazGyawali: Good one !!Outfit
Can you tell me the steps which i should use....please mail me bro at [email protected]Clyte
M
3

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

enter image description here

Hope this works for you

Mckinnon answered 28/7, 2015 at 5:25 Comment(0)
A
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
Amphibole answered 4/8, 2015 at 15:59 Comment(6)
Do you have some sample or anything else..i am not able to find anything like it...Clyte
@tufan, first lesson on SO: don't ask for code.Amphibole
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 itClyte
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.Amphibole
@Clyte Google for "item decorator in RecyclerView"Amphibole
okay thank you i am searching for it....i had lost my hope now i have a seen a light ...i m trying thanksClyte

© 2022 - 2024 — McMap. All rights reserved.