Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Fragments Introducing Fragments Checking It Twice

vicente lee
vicente lee
6,271 Points

LinearLayoutManager

I'm still confused about what the LayoutManager does. Why do we need a LayoutManager, is this because we are working with fragments? I don't remember using LayoutManager when working with the usual adapters.

1 Answer

Kourosh Raeen
Kourosh Raeen
23,733 Points

It's not because we're working with a fragment. It's because we're using a RecyclerView, which requires a layout manager so that it knows how we want the items to be displayed, in a vertical or horizontal linear scrolling list, in a grid, or in a staggered grid. You can read more about RecyclerView in this tutorial:

https://guides.codepath.com/android/Using-the-RecyclerView#components-of-a-recyclerview