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
Let’s us now start implementing our android application with RecycleView with GridLayoutManager with example. Step 1: Create a New Project And Name It RecyclerViewExample. OfCouse, your need to create a new android project using android-studio, or else you can make use of your existing android project.
if you want to set grid layout in reyclerview in xml file then you can put these two in in recyclerview xml. if you want to set grid layout from java code you can write this. in your MainActivity, where u assigned your recycler view, just use this code.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. In the above code, we have taken recycerview. Step 3 − Add the following code to src/MainActivity.java
There are two types of layout managers for Recycler View to implement. In linear layout manager, we can align our recycler view in a horizontal or vertical scrolling manner by specifying its orientation as vertical or horizontal. In Grid Layout manager we can align our recycler in the form of a grid.
I suggest you to use StaggeredGridLayoutmanager
for your recycler view.
It's the closest approach to achieve your layout.
You can find the docs here. And working example can be found here.
You can learn from this example which explain perfect about Recycler View
Hope this works for you
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.
GridLayoutManager
StaggeredGridLayoutManager
GridLayoutManager
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With