Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Setting Padding1:14 with Ben Deitch
In this video we'll talk about how to add padding to our layout!
We're almost done with our layout.
The last thing we need to do is set the padding around our views
to match the mockups.
If we take another look, we see that there's some space between
each of our views and the edges of the screen.
We can change the amount of space by updating the padding property
of our relative layout.
Let's try to do this in XML.
Over on the Text tab, inside the relative layout element,
let's add a line below where we set the background.
Then type android:padding, and
set it equal to, in quotes, 50 DP.
Remember how we used SP as the units for tech size?
Well, DP is similar.
DP stands for density independent pixels.
Android devices can have all sorts of different screen resolutions.
And using density independent pixels helps us make sure that our app looks relatively
consistent across all those devices.
And now, we can see that our views have a little space offsetting
them from the edges of our relative layout, just like in the mockups.
In the next video, we'll see how to get rid of this bar at the top of the screen
You need to sign up for Treehouse in order to download course files.Sign up