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 Build a Simple Android App Creating the Screen Layout Setting Padding

Kerry Smyth
Kerry Smyth
3,921 Points

This video needs to be updated. No default dimen.xml file in res folder.Also the Relative Layout is not in the Component

This video needs to be updated. No default dimen.xml file in res folder. Also the Relative Layout is not in the Component Tree. Is this now renamed "ConstraintLayout"?

Finally worked out how to add the dimen.xml file then reference that new file in the activity_fun_facts.xml file. After doing all this the background colour was cropped with either a padding or margin value. Ended up just increasing the left/right margins on the button. This took about 30min ++.

Please update the video & or include notes about changes to the studio application.

2 Answers

Ben Deitch
STAFF
Ben Deitch
Treehouse Teacher

Hey Kerry!

Yep, we'll be doing a refresh of this course in the next month or two. In the mean time I've added a couple notes to help folks get started with the right layout. Also, here's the layout as it currently exists if you'd like to take a look. And since dimens.xml isn't included in the default project anymore, a good fix for the dimensions is just to replace all 4 of those padding attributes with 'android:padding="16dp"; that'll add 16 dps of padding to each side.

Hope that helps!

Kerry Smyth
Kerry Smyth
3,921 Points

Hi Ben,

Great if you can ease the frustration for others going through the course.

I am looking forward to following the new series.

Also I am doing a programming course at the moment (mainly C#) but have now started making basic apps with A.S. / Java. The class (OOP) approach you went through in the FunFact App is a lot better / cleaner than what we are currently being taught in my course.

Thanks man,

Kerry

Kristian Gonzalez
Kristian Gonzalez
Courses Plus Student 1,105 Points

I added the layout suggested above, but it indicated 2 Render errors. Please redo soon. Very frustrating and look forward to the new course.

Mustafa Ogün Öztürk
Mustafa Ogün Öztürk
3,468 Points

Just add these 4 lines to your RelativeLayout

android:paddingBottom="50dp" android:paddingLeft="50dp" android:paddingRight="50dp" android:paddingTop="50dp"

instead of these

android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"