Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 22.214.171.124 release ready!
Today we are going to learn the switching between list and grid view with data binding and recyclerview, as we have seen in many m-commerce sites.
We are going to use a static flag to check whether we have to inflate grid view or list view. The flag is intially set to list view (i.e static Boolean isGrid=false; ). You can do this by saving a value to the shared preferences.
Start by creating two xml file for two views (list and grid). You can create your own view file I had created the two as item.xml and item_grid.xml.
Now in main activity we need a view switcher we are using a imageview inside a FloatingAction Button.
And the activity will be like
Now the important part is creating adapter for both the views
And its ready. you can use any number of views but try to not make it so complicated by adding unnecessary views. So thats all about recycler view with data binding.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.