Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

J A
seal-mask
.a{fill-rule:evenodd;}techdegree
J A
Full Stack JavaScript Techdegree Student 4,616 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.