2

I'm trying to make an app that creates multiple Product objects and orders them from best value to worst. What is the best way to have a set layout and display the same layout, repeating down the screen, but with each products price brand volume etc substituted?

Thomas
  • 435
  • 6
  • 20

2 Answers2

1

The way to display multiple product is to use list view. There are various forms of list view available, you can use expandable listview or can also use simple listview and follow master-detail format. Even play store also uses listview to display their apps(products). If you are trying to load large amount of data then you can use lazy loading technique along with caching.

Jay Gajjar
  • 2,661
  • 2
  • 21
  • 35
1

Option 1:

For reusing the same layout in a grid or list fashion you should use Custom GridView or Custom ListView.

These don't use arrayAdapters,instead use custom adapter that extends base adapter which inflates a specific layout for each row/ grid.

Related links :

custom grid view

custom listview

Option 2:

If you do not want to show reusable layout in grid or list manner then, Inflate the desired layout(xml) multiple times based on your requirement using the following link

Inflate a view / layout into another layout?

Community
  • 1
  • 1
Rachita Nanda
  • 4,509
  • 9
  • 42
  • 66