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 trialJace Galloway
1,464 PointsFullscreen
I've never been able to get anything (images & buttons so far) to go actual full screen and touch the edge of the display, it always stops just a little before the edge... Is this a common problem? Or am I missing something?
2 Answers
Ernest Grzybowski
Treehouse Project ReviewerHey Jace Galloway this is mostly because Android (recently) started to implement a default padding on the layouts in your .xml files.
For example, if you create a brand new application in Android you will get a layout that will look like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
You can see that inside of the RelativeLayout it has:
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
which basically tells Android to go and look in res > values > dimens.xml
. If you navigate to that file and open up the .xml you will see it contains:
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
Bam! That is where you default padding is coming from. As you can see, it gives you the defaults, per the Android Design Guidelines. Try changing the numbers in the dimens.xml file and you will see it update in your layout. Pretty cool!
Learn more about Android design here: http://developer.android.com/design/index.html
Anthony Hind
5,715 Pointssorry didn't see your android tag ...
Jace Galloway
1,464 PointsJace Galloway
1,464 PointsOnce again, thank you for your invaluable help!
Stefan Bols
2,515 PointsStefan Bols
2,515 PointsExactly my problem - thanks!