Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Setting Padding1:13 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 our markups.
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 a relative layout.
Let's try to do this in XML.
Over on the text tab inside the relative layout element,
add a line below where we set the background.
Then type android:padding and
set it equal to, in quotes, 50dp.
Remember how we used sp as the units for text 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 our app looks
relatively consistent across all those devices.
And now we can see that our views have a little space off setting them
from the edges of our relative layout, just like in the mock ups.
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