0

I want to make a view with first item is larger than others like attach image. i used RecyclerView but i don't know how to custom layout for first item. Someone please tell me the way to do it.

Many thanks!

Pak Nork
  • 123
  • 3
  • 7
  • This tutorial might help you get started: https://www.binpress.com/tutorial/android-l-recyclerview-and-cardview-tutorial/156 – buczek Apr 26 '16 at 18:49

2 Answers2

0

You should look into view types for RecyclerView. This allows you to use different layouts for different types of rows. You can find several examples on this site such as this.

Community
  • 1
  • 1
Juan Cortés
  • 20,634
  • 8
  • 68
  • 91
0

I recommend you to use a StaggeredGridLayout in your RecyclerView. It will look like Pinterest and you can then put all the items of the same size, except for the first one where you can put a bigger one and the layout will do everything for you. The StaggeredGridLayout will look like this: StaggeredGridLayout

You can also use a GridLayout and make an item use more than one cell like here: GridLayout

You can easily google for a tutorial using the terms I provided.

I hope it helps!

Isaac Urbina
  • 1,295
  • 11
  • 21