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 Lists and Adapters (2015) Lists with RecyclerViews Creating the Item Layout

Abhinav Kanoria
Abhinav Kanoria
7,730 Points

Use of adding padding values

Even though I know I'm asking a basic question, still, I need to know just to get a clear view of things. Why do we add padding in the custom layout we created in this video?? android:paddingTop = "8dp" android:paddingBottom = "8dp" What purpose does it serve here to add padding?

1 Answer

Full Stack JavaScript Techdegree Student 4,646 Points

So remember that this layout will be used for each item in the list view. Adding the 8dp padding to the top and bottom is purely for appearance. That is, it just makes the items appear less bunched together and spaces them out when you display multiple items in the list. Hope this helps your understanding.